c#中在Paint函数中载入资源图为何不停地重绘?
在pictureBox控件paint函数中载入资源图片
debug时输出框不停地刷TRACE:pictureBox1_Paint,程序运行就不停地重绘,未使用Invalidate()函数,这是为何?
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
System.Diagnostics.Trace.WriteLine("pictureBox1_Paint");
switch (DevState)
{
case 0:
pictureBox1.Image = DevIcon.Properties.Resources.Fan_UnStat;
break;
case 1:
pictureBox1.Image = DevIcon.Properties.Resources.Fan_Start1;
break;
case 2:
pictureBox1.Image = DevIcon.Properties.Resources.Fan_Stop1;
break;
case 3:
pictureBox1.Image = DevIcon.Properties.Resources.Fan_Fault1;
break;
case 4:
pictureBox1.Image = DevIcon.Properties.Resources.Fan_Other;
break;
}
}
debug时输出框不停地刷TRACE:pictureBox1_Paint,程序运行就不停地重绘,未使用Invalidate()函数,这是为何?
...全文


