你好我只是想创建我的第一个游戏之一,为此我决定使用gif动画但不知何故用鼠标点击应用程序而不是用单个消息更改动画折叠甚至不在错误栏中说:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in System.Drawing.dll
代码:
bool shoot = false;
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
ballon_grey.Location = new Point(ballon_grey.Location.X,ballon_grey.Location.Y - 5);
}
private void ballon_grey_MouseClick(object sender, MouseEventArgs e)
{
shoot = true;
if (shoot == true)
{
ballon_grey.Image = Image.FromFile("baloon_explosion.gif");
}
}
答案 0 :(得分:1)
如果它在您的资源中,您只需要这样:
ballon_grey.Image = YourApplication.Properties.Resources.baloon_explosion;