问题描述
我想在 PaintEvent 中使用多个 case,使用 Timer 切换:
protected override void OnPaint(PaintEventArgs e)
{
switch (scene)
{
case 1:
foreach (Tunnels boxes in tunnellist)//draws series of boxes,creating "tunneleffect" by looping using Invalidate();
{
boxes.Draw(e.Graphics);
Invalidate();
}
break;
case 2:
foreach (....//here I would like to have some other effect,for example drawing list of sprites moving using sine-waves etc.
break;
default:
break;
}
}
在计时器中我有以下内容(每 20 秒打勾):
private void timer1_Tick(object sender,EventArgs e)
{
if (scene > 1)
{
scene = 1;
}
else
{
scene++;
}
this.Invalidate();
}
这里的问题是,因为我在 PaintEvent 中有 Invalidate(),所以计时器永远不会触发。任何想法如何解决这个问题?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)