在Winforms Textbox
中,我定义了新的ToolTip
并对其进行了配置。我已将PasswordChar
设置为'*'。但是,当大写锁定开启时,会显示两个tooltip
。其中一个是我的,另一个是系统的默认tooltip
通知。我只想展示我的tooltip
。我想禁用系统的tooltip
。我该如何禁用它?
答案 0 :(得分:1)
一种方法是从现有文本框控件派生自己的文本框控件并处理EM_SHOWBALLOONTIP消息。然后将此控件拖到表单上,而不是常规文本框控件。
public partial class PasswordTextBox : TextBox
{
private const int EM_SHOWBALLOONTIP = 0x1503;
protected override void WndProc(ref Message m)
{
if (m.Msg == EM_SHOWBALLOONTIP)
{
m.Result = (IntPtr)0;
return;
}
base.WndProc(ref m);
}
public PasswordTextBox()
{
InitializeComponent();
}
}