【发布时间】:2009-08-24 15:58:11
【问题描述】:
我有一个弹出控件的对话框,当控件悬停在控件上时,会显示一个工具提示。但是,如果我关闭该框然后重新显示它,则没有工具提示将起作用。这是我的代码的一部分。当表单加载为空时,我正在初始化 tooltipOn。我已经完成了跟踪,并且 tooltip1.Show() 确实在第二次被调用时根本不会显示。知道为什么吗?
private void Panel1_MouseMove(object sender, MouseEventArgs e)
{
Control ctrl = null;
if (sender == Panel1)
ctrl = ((Control)sender).GetChildAtPoint(e.Location);
else
ctrl = (Control)sender;
if (ctrl != null)
{
if (tooltipOn != ctrl)
{
toolTip1.Show(toolTip1.GetToolTip(ctrl), ctrl, ctrl.Width / 2, ctrl.Height / 2);
tooltipOn = ctrl;
}
}
else
{
toolTip1.Hide(this);
tooltipOn = null;
}
}
【问题讨论】: