winform中切换图标实现闪动效果时,图标会出现为一个大红叉,不知道什么原因,请高手帮助
winform中切换图标实现闪动效果时,图标会出现为一个大红叉,而且出现几率不规则,不知道什么原因,请高手帮助 --------------------编程问答-------------------- 红叉表示绘图失败,代码有bug --------------------编程问答-------------------- 图片路径有问题试试把图片保存为本地资源 --------------------编程问答-------------------- 我是将我要切换的图片用static构造好后用定时器定时切换的,应该在程序启动时就构造好了吧 --------------------编程问答-------------------- 没高人指点吗,顶一下 --------------------编程问答-------------------- 代码看看 --------------------编程问答-------------------- static int changerCounter = 0;
static ArrayList myControl = new ArrayList();
static Image image11 = Image.FromFile(Application.StartupPath + "\\Notify_Icon\\NEW11.ico");
static Image image12 = Image.FromFile(Application.StartupPath + "\\Notify_Icon\\NEW12.ico");
......
for (int j = 0; j < myControl.Count; j++)
{
if (myControl[j] != null)
{
if (myControl[j].GetType().ToString() == "System.Windows.Forms.PictureBox")
{
System.Windows.Forms.PictureBox pBox = myControl[j] as PictureBox;
switch(msgPriority)
{
case 0:
if(changerCounter%2 == 0)
pBox.Image = image12; else pBox.Image = image11; break;
case 1:
if(changerCounter%2 == 0) pBox.Image = image22; else pBox.Image = image21;
break;
case 2:
if(changerCounter%2 == 0)
pBox.Image = image32;
else
pBox.Image = image31;
break;
}
}
......
changerCounter = (changerCounter+1)%6;
}
补充:.NET技术 , C#