Kje*_*sen 9 tooltip .net-2.0 winforms
对于文本框,我想在焦点位于文本框时立即显示工具提示,并在焦点持续时间内停留 - 而不仅仅是当鼠标悬停在文本框上时.

我怎样才能做到这一点?
Lar*_*ech 16
在Enter与Leave此事件可能是有用的,为0的时间拿出来给它保留下来.
private ToolTip tt;
private void textBox1_Enter(object sender, EventArgs e) {
tt = new ToolTip();
tt.InitialDelay = 0;
tt.IsBalloon = true;
tt.Show(string.Empty, textBox1);
tt.Show("I need help", textBox1, 0);
}
private void textBox1_Leave(object sender, EventArgs e) {
tt.Dispose();
}
Run Code Online (Sandbox Code Playgroud)
注意:Show(...)在我的示例中调用方法两次将强制"指针"正确指向控件.
小智 5
经过测试,事件名称:
private void textbox_Enter(object sender, EventArgs e)
{
toolTip1.Show("your tip here", textbox);
}
private void textbox_Leave(object sender, EventArgs e)
{
toolTip1.Hide(textbox);
}
Run Code Online (Sandbox Code Playgroud)
工具提示是一个控件,需要从工具箱中添加。
| 归档时间: |
|
| 查看次数: |
21158 次 |
| 最近记录: |