C# WebBrowser 控件问题。
我用WebBrowser绑定了以个类似BBS的链接。然后又用NotifyIcon控件为主窗体做了个托盘图标。。。现在想让BBS中有新消息的时候。托盘图标就闪动。。该怎么弄...
我用WebBrowser绑定了以个类似BBS的链接。然后又用NotifyIcon控件为主窗体做了个托盘图标。。。现在想让BBS中有新消息的时候。托盘图标就闪动。。该怎么弄?给个思路。
谢谢啦~~ 展开
谢谢啦~~ 展开
1个回答
2011-03-14
展开全部
简单方法就是用图片
有新信息时显示GIF动态图片
查看后显示静态图片
网上找的仿造QQ图标闪烁,参考:http://sweetbhy521.blog.sohu.com/80834945.html
希望对你有所帮助
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace 仿造QQ图标闪烁
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private Icon ico1 = new Icon("MOON01.ICO");
private Icon ico2 = new Icon("MOON02.ICO");
private Icon ico3 = new Icon("MOON03.ICO");
private Icon ico4 = new Icon("MOON04.ICO");
private Icon ico5 = new Icon("MOON05.ICO");
private Icon ico6 = new Icon("MOON06.ICO");
//private Icon ico7 = new Icon("MOON07.ICO");
//private Icon ico8 = new Icon("MOON08.ICO");
//用语存放以上的实例
private ArrayList ay = new ArrayList();
private int i = 0;
private void Form1_Load(object sender, EventArgs e)
{
//窗口起始状态
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
//窗体完全透明,这个可要可不要。.
// this.Opacity = 0;
//不显示在任务栏
this.ShowInTaskbar = false;
//将所有ICO对象放进集合中
ay.Add(ico1);
ay.Add(ico2);
ay.Add(ico3);
ay.Add(ico4);
ay.Add(ico5);
ay.Add(ico6);
//ay.Add(ico7);
//ay.Add(ico8);
//timer时间间隔
this.timer1.Interval = 100;
this.notifyIcon1.Icon = ico1;
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
}
//private void notifyIcon1_MouseUp(object sender, MouseEventArgs e)
//{
// //得到右健菜单
// contextMenu1.GetContextMenu();
//}
private void 开始ToolStripMenuItem_Click(object sender, EventArgs e)
{
//开始记时
this.timer1.Enabled = true;
}
private void 开始ToolStripMenuItem1_Click(object sender, EventArgs e)
{
//开始记时
this.timer1.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
//ICO转换控制。
if (i < 5)
{
notifyIcon1.Icon = (Icon)ay[i];
i++;
return;
}
else
notifyIcon1.Icon = (Icon)ay[0];
i = 1;
}
private void 停止ToolStripMenuItem_Click(object sender, EventArgs e)
{
//停止记时
this.timer1.Enabled = false;
}
private void 停止ToolStripMenuItem1_Click(object sender, EventArgs e)
{
//停止记时
this.timer1.Enabled = false;
}
private void 退出ToolStripMenuItem1_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
有新信息时显示GIF动态图片
查看后显示静态图片
网上找的仿造QQ图标闪烁,参考:http://sweetbhy521.blog.sohu.com/80834945.html
希望对你有所帮助
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace 仿造QQ图标闪烁
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private Icon ico1 = new Icon("MOON01.ICO");
private Icon ico2 = new Icon("MOON02.ICO");
private Icon ico3 = new Icon("MOON03.ICO");
private Icon ico4 = new Icon("MOON04.ICO");
private Icon ico5 = new Icon("MOON05.ICO");
private Icon ico6 = new Icon("MOON06.ICO");
//private Icon ico7 = new Icon("MOON07.ICO");
//private Icon ico8 = new Icon("MOON08.ICO");
//用语存放以上的实例
private ArrayList ay = new ArrayList();
private int i = 0;
private void Form1_Load(object sender, EventArgs e)
{
//窗口起始状态
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
//窗体完全透明,这个可要可不要。.
// this.Opacity = 0;
//不显示在任务栏
this.ShowInTaskbar = false;
//将所有ICO对象放进集合中
ay.Add(ico1);
ay.Add(ico2);
ay.Add(ico3);
ay.Add(ico4);
ay.Add(ico5);
ay.Add(ico6);
//ay.Add(ico7);
//ay.Add(ico8);
//timer时间间隔
this.timer1.Interval = 100;
this.notifyIcon1.Icon = ico1;
}
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
}
//private void notifyIcon1_MouseUp(object sender, MouseEventArgs e)
//{
// //得到右健菜单
// contextMenu1.GetContextMenu();
//}
private void 开始ToolStripMenuItem_Click(object sender, EventArgs e)
{
//开始记时
this.timer1.Enabled = true;
}
private void 开始ToolStripMenuItem1_Click(object sender, EventArgs e)
{
//开始记时
this.timer1.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
//ICO转换控制。
if (i < 5)
{
notifyIcon1.Icon = (Icon)ay[i];
i++;
return;
}
else
notifyIcon1.Icon = (Icon)ay[0];
i = 1;
}
private void 停止ToolStripMenuItem_Click(object sender, EventArgs e)
{
//停止记时
this.timer1.Enabled = false;
}
private void 停止ToolStripMenuItem1_Click(object sender, EventArgs e)
{
//停止记时
this.timer1.Enabled = false;
}
private void 退出ToolStripMenuItem1_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
追问
恩。先谢过。。不过我这个问题的重点是要问一下怎样检测到页面中是否有新消息。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询