我正在写游戏,我创建了一个继承自PictureBox
的类class Mashrooms : System.Windows.Forms.PictureBox
{
public Mashrooms(int x, int y)
{
Name = "mush";
Location = new Point(x, y);
Enabled = true;
//Image = Image.FromFile("mushroom.png");
ImageLocation = @"mushroom.png";
Size = new Size(16,32);
}
}
在form1.Designer.cs中我放了
Mashrooms m = new Mashrooms (200,50);
this.Controls.Add(m);
即使游戏运行,图片也不会显示。