C# 如何延迟工具提示的显示?
可能重复:C# 如何延迟工具提示的显示?,c#,.net,winforms,C#,.net,Winforms,可能重复: 我需要工具提示显示在3秒钟后,用户移动鼠标光标的控制,现在它立即显示 我试着这样做: this.toolTip.AutoPopDelay = 3000; this.toolTip.InitialDelay = 3000; this.toolTip.ReshowDelay = 3000; this.toolTip.AutomaticDelay = 3000; private void control_MouseMove(object sender, MouseEventArgs e
我需要工具提示显示在3秒钟后,用户移动鼠标光标的控制,现在它立即显示 我试着这样做:
this.toolTip.AutoPopDelay = 3000;
this.toolTip.InitialDelay = 3000;
this.toolTip.ReshowDelay = 3000;
this.toolTip.AutomaticDelay = 3000;
private void control_MouseMove(object sender, MouseEventArgs e)
{
toolTip.SetToolTip(control, "My info");
}
但由于某些原因,它不起作用,仍然会立即显示,我做错了什么?更改
this.toolTip.InitialDelay=3000代码>到this.toolTip.InitialShowDelay=3000
这将在显示时设置延迟我在帮助页面上没有看到该属性:。InitialShowDelay
属性不存在这是因为您调用SetToolTip()太频繁。在第二次调用时,在第一次调用后的毫秒内发生,因为鼠标正在移动,InitialDelay被取消,提示立即显示。预期的用法是只调用一次SetToolTip,通常在表单构造函数中。有一个简单的解决方案:它对所有VS版本都有效。我在VS2015项目中使用了它。