为什么编译能通过,运行时却没效果。
class apple{
public int x;
public int y;
public Bitmap tupian=null;
public apple()
{
tupian = new Bitmap(500,500);
}
public Bitmap move()
{
Graphics g = Graphics.FromImage(tupian);
Pen p = new Pen(Color.Red);
g.Clear(Color.Yellow);
g.DrawEllipse(p, x, y, 50, 100);
x = x + 5;
y = y + 5;
return tupian;
}
}
//以下是window窗口下的form1.
public partial class Form1 : Form
{
apple abc = new apple() ;
public Form1()
{
InitializeComponent();
}
private void button1_Click_1(object sender, EventArgs e)
{
timer1.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
pictureBox1.Image = abc.move();
}
}