C#的tooltip自动消失之后就不再显示了

上一篇 / 下一篇  2013-01-11 14:56:34

在控件上加上tooltip之后,鼠标放到控件上,tooltip出来,等tooltip自动消失之后,再将鼠标放到控件上去时就不会再显示tooltip了

解决方法:给tooltip加上MouseEnter 和MouseLeave的事件,在事件里面设置tooltip的Active状态

Label label= new Label();
ToolTip toolTip1 = new ToolTip();
toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 500;
toolTip1.ReshowDelay = 500;
toolTip1.ShowAlways = true;
toolTip1.SetToolTip(this.label, "提示的内容");
toolTip1.ToolTipTitle = "提示的标题";
label.MouseEnter += new System.EventHandler(this.toolTip1_MouseEnter);
label.MouseLeave += new System.EventHandler(this.toolTip1_MouseLeave);

private void toolTip1_MouseEnter(object sender, EventArgs e)
{
    this.toolTip1.Active = true;
}

private void toolTip1_MouseLeave(object sender, EventArgs e)
{
     this.toolTip1.Active = false;
}

TAG:

 

评分:0

我来说两句

日历

« 2024-05-12  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 18084
  • 日志数: 4
  • 建立时间: 2012-12-20
  • 更新时间: 2013-01-14

RSS订阅

Open Toolbar