【发布时间】:2019-06-04 11:43:53
【问题描述】:
我的 winform 中有一个椭圆,我试图随机更改其填充属性,即我希望椭圆的颜色不断变化。
SolidBrush colour;
private void drawBorder()
{
Pen bPen = new Pen(Color.Black, 8);
colour = new SolidBrush(Color.Yellow);
g.DrawEllipse(bPen, 412, 269, 19, 19);
g.FillEllipse(colour, 412, 269, 19, 19);
timer1.Enabled = true;
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
//g.FillEllipse(colour, 412, 269, 19, 19);
if (this.colour.Color == Color.Yellow)
{
//MessageBox.Show("!", Color.Yellow.ToString());
this.colour.Color = Color.Pink;
}
if (this.colour.Color == Color.Pink)
{
//MessageBox.Show("#", this.colour.Color.ToString());
this.colour.Color = Color.Yellow;
}
}
【问题讨论】: