关于 notifyIcon 控件事件的问题
我想当鼠标在notifyIcon控件上停留一会儿然后notifyIcon1.ShowBalloonTip(5000)别的控件有 Hover 事件
可是notifyIcon控件没有 Hover 事件
请问怎么实现这个功能 --------------------编程问答-------------------- public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private bool balloonShown = false;
private void notifyIcon1_MouseMove(object sender, MouseEventArgs e)
{
if (!balloonShown)
{
lock (this)
{
balloonShown = true;
}
notifyIcon1.ShowBalloonTip(5000);
}
}
private void notifyIcon1_BalloonTipClosed(object sender, EventArgs e)
{
// 锁定变量
lock (this)
{
balloonShown = false;
}
}
}
--------------------编程问答-------------------- 谢谢楼上的..我要的是鼠标在notifyIcon控件上停留一会儿然后notifyIcon1.ShowBalloonTip(5000)
你给的代码是一下就显示了 --------------------编程问答-------------------- --------------------编程问答-------------------- up --------------------编程问答-------------------- 想不出什么方法来侦测鼠标是否悬停超过一定时间……up一下 --------------------编程问答-------------------- 设置timer1属性Interval为1000,设置notifyIco1属性BalloonTipText为"Girl",BalloonTipTitle为"Hi"
以下代码为5秒钟显示一次;
private int i;
private void notifyIcon1_MouseMove(object sender, MouseEventArgs e)
{
this.timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
i++;
if (i == 5) //时间为5秒钟
{
notifyIcon1.ShowBalloonTip(5000);
this.timer1.Stop();
i = 0;
}
} --------------------编程问答-------------------- 上面的代码是只要鼠标移过就开始计时,
离开后时间到了还是显示
补充:.NET技术 , C#