初学C#,遇到问题,有哪位前辈指教下
程序代码:
{ public partial class Form5 : Form { Image img; Graphics g; Pen p; Brush bu, bu1; PointF pt; Form1 f1; public Form5(Form1 f) { InitializeComponent(); f1=f; timer1.Interval = 50; g = this.CreateGraphics(); p = new Pen(Color.Black, 1.0f); bu = new SolidBrush(Color.White); bu1 = new SolidBrush(Color.Black); img = Image.FromFile("FlagMeterLevelProgress.png"); pt = new PointF(); pt.X = 0; pt.Y = 0; Font = new Font("unicode", 9.0f); } private void button1_Click(object sender, EventArgs e) { Close(); f1.Show(); } private void button2_Click(object sender, EventArgs e) { timer1.Enabled =true; } float x = 0, y = 100; int a = 5, b = 5; int sx; int score; private void timer1_Tick(object sender, EventArgs e) { g.DrawRectangle(p,0,0,300,400); x+=a;y+=b; if (x < 0) a = 5; if (x > 275) a = -5; if (y < 0) b = 5; if (y > 355 && x > sx && x < sx + 86 && y < 375) { b = -5; score += 10; } g.FillRectangle(bu, 0, 0, 300, 400); g.DrawRectangle(p, x, y, 20, 20); g.DrawImage(img, sx, 375); g.DrawString("Hide score;" + Convert.ToString(score), Font.Italic, bu1, pt); } } } 请问哪里有错误,运行不起来!请高手指教
[ 本帖最后由 Gin清 于 2011-8-5 20:20 编辑 ]