日期:2014-05-18 浏览次数:20933 次
private void panel1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Pen pen1 = new Pen(Color.Red); Pen pen2 = new Pen(Color.Green); SolidBrush brush1 = new SolidBrush(Color.Red); SolidBrush brush2 = new SolidBrush(Color.Green); for (int i = 0; i < 3; i++) { if (time >= 0 && time <= 3) { g.DrawEllipse(pen2, this.panel1.Width / 2 + i * 25, this.panel1.Height / 2 - 150, 20, 20); g.FillEllipse(brush2, this.panel1.Width / 2 + i * 25, this.panel1.Height / 2 - 150, 20, 20); } else { g.DrawEllipse(pen2, this.panel1.Width / 2 + i * 25, this.panel1.Height / 2 - 150, 20, 20); g.FillEllipse(brush2, this.panel1.Width / 2 + i * 25, this.panel1.Height / 2 - 150, 20, 20); } } Graphics g1 = e.Graphics; Pen pen3 = new Pen(Color.White); SolidBrush brush3 = new SolidBrush(Color.White); for (int i = 0; i < 35; i++) { g1.DrawRectangle(pen3, 2 + i * 20, this.panel1.Height / 2-120, 10, 150); g1.FillRectangle(brush3, 2 + i * 20, this.panel1.Height / 2-120, 10, 150); } }
private void timer1_Tick(object sender, EventArgs e)
{
this.panel1_Paint(sender, e);
}
private void timer1_Tick(object sender, EventArgs e) { this.panel1.Refresh(); }