我像这样使用Tooltip类...
其中ctrl是一个图片ctrl。
ToolTip oTooltip =新建ToolTip();oTooltip.SetToolTip(ctrl,“算法已成功完成”);oTooltip.ShowAlways = true;
加载表单时,将显示工具提示...每当我将鼠标悬停在它上面时,它就会显示两三次,但从第四次悬停开始,它就不再出现了。
有什么我需要设置的吗?
发布于 2010-07-02 17:43:37
不久前我也遇到过类似的问题。为了解决这个问题,我订阅了控件的MouseEnter事件,并在将ToolTip的Active属性从false设置为true之间切换。我的代码看起来像这样:
using System;
using System.Windows.Forms;
public Form1()
{
this.pictureBox1.MouseEnter += new EventHandler(pictureBox1_MouseEnter);
this.ToolTip = new ToolTip();
this.ToolTip.SetToolTip(this.pictureBox1, "The algorithm has been completed successfully.")
}
private ToolTip ToolTip
{
get;
set;
}
private void pictureBox1_MouseEnter(object sender, EventArgs e)
{
this.ToolTip.Active = false;
this.ToolTip.Active = true;
}希望这能有所帮助。
https://stackoverflow.com/questions/3164495
复制相似问题