C#跟QQ一样有消息过来就闪烁怎么做的饿啊 用NotifyIcon控件和timer组件就可以,每隔多长时间换个图片就是闪烁效果了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我做过 消失来时 改变图片位置就好了 时间间隔500ms 改变坐标位置 然后 500ms还原坐标位置 楼上说很好。而且实现起来也比较简单。我也试演过,就是用一个TIMER和NotifyIcon,用时间来控制NotifyIcon更换图片的时间。两个不同的图片,分时来更换就OK了。 有消息过来触发事件,事件方法中将Icon换掉,查看消息后再把Icon换回去 NotifyIcon控件和timer控件 然后用时间控件控制时间间隔当检测到消息到来 那么就触发时间控件 计时 NotifyIcon更换图片. 如果任务栏也闪的话 FlashWindow 用到两个时间控件,一个图片控件 //窗体启动 private void Form1_Load(object sender, EventArgs e) { //时间控件运行 this.timer1.Start(); } //0.2秒之后运行 private void timer1_Tick(object sender, EventArgs e) { this.pictureBox1.Left+=2; this.pictureBox1.Top += 2; this.timer2.Start(); this.timer1.Stop(); } //0.2秒之后运行 private void timer2_Tick(object sender, EventArgs e) { this.pictureBox1.Left -= 2; this.pictureBox1.Top -= 2; this.timer1.Start(); this.timer2.Stop(); } /// <summary> /// 闪动!!每隔0.N 秒调用 /// </summary> /// <param name="StripBtn"></param> public static void BtnFlash(ToolStripSplitButton StripBtn) { ToolStripItemCollection items = StripBtn.DropDownItems; if (items.Count != 0) { if (StripBtn.Text == "消息") StripBtn.Text = "新的"; else StripBtn.Text = "消息"; foreach (ToolStripItem item in items) { if (item.DisplayStyle == ToolStripItemDisplayStyle.Image) item.DisplayStyle = ToolStripItemDisplayStyle.Text; else item.DisplayStyle = ToolStripItemDisplayStyle.Image; } } else StripBtn.Text = "聊天"; } bool flag = true; private void timer1_Tick(object sender, EventArgs e) { if (flag == false) { notifyIcon1.Icon = System.Drawing.Icon.ExtractAssociatedIcon("d:\\1.ico"); flag = true; } else { notifyIcon1.Icon = System.Drawing.Icon.ExtractAssociatedIcon("d:\\2.ico"); flag = false; } } VSS的问题,马上结贴 谁做过C#序列号?急。。 分布式开发 如何解决新建word后打开时不是只读的情况 与动态创建控件-创建窗口句柄出错,这类问题为什么没人解决? icmp数据包 头部校验和的问题 紧急求助,关于用C#引用Por E 朋友们向我推荐几本C#书吧,关于程序扩展,升级(补丁升级,在线升级)方面的,半小时结贴 那们高手写过就帮一忙啰,急!!! Modbus RTU与PLC通讯问题 DataGridView分页后排序的问题 ■■■一个关于windows服务启动外部程序的问题,折磨了我很久
当检测到消息到来 那么就触发时间控件 计时 NotifyIcon更换图片.
//窗体启动
private void Form1_Load(object sender, EventArgs e)
{
//时间控件运行
this.timer1.Start();
}
//0.2秒之后运行
private void timer1_Tick(object sender, EventArgs e)
{
this.pictureBox1.Left+=2;
this.pictureBox1.Top += 2;
this.timer2.Start();
this.timer1.Stop();
}
//0.2秒之后运行
private void timer2_Tick(object sender, EventArgs e)
{
this.pictureBox1.Left -= 2;
this.pictureBox1.Top -= 2;
this.timer1.Start();
this.timer2.Stop();
}
/// 闪动!!每隔0.N 秒调用
/// </summary>
/// <param name="StripBtn"></param>
public static void BtnFlash(ToolStripSplitButton StripBtn)
{
ToolStripItemCollection items = StripBtn.DropDownItems;
if (items.Count != 0)
{
if (StripBtn.Text == "消息")
StripBtn.Text = "新的";
else
StripBtn.Text = "消息";
foreach (ToolStripItem item in items)
{
if (item.DisplayStyle == ToolStripItemDisplayStyle.Image)
item.DisplayStyle = ToolStripItemDisplayStyle.Text;
else
item.DisplayStyle = ToolStripItemDisplayStyle.Image;
}
}
else
StripBtn.Text = "聊天";
}
private void timer1_Tick(object sender, EventArgs e)
{
if (flag == false)
{
notifyIcon1.Icon = System.Drawing.Icon.ExtractAssociatedIcon("d:\\1.ico");
flag = true;
}
else
{
notifyIcon1.Icon = System.Drawing.Icon.ExtractAssociatedIcon("d:\\2.ico");
flag = false;
} }