问题描述
在 Winforms Textbox
中,我定义了新的 ToolTip
并进行了配置.我已将 PasswordChar
设置为*".但是,当大写锁定打开时,会显示两个 tooltip
.其中一个是我的,另一个是系统默认的 tooltip
通知.我只想显示我的 tooltip
.我想禁用系统的tooltip
.如何禁用它?
In Winforms Textbox
, I have defined new ToolTip
and configured it. I have set the PasswordChar
to '*'. However, when caps lock is on, two tooltip
is shown. One of them is mine the other one is system's default tooltip
notification. I only want to show my tooltip
. I want to disable system's tooltip
. How can I disable it?
推荐答案
一种方法是从现有的文本框控件派生您自己的文本框控件并处理 EM_SHOWBALLOONTIP 消息.然后只需将此控件拖到您的表单上,而不是常规的文本框控件.
One way is to derive your own textbox control from the existing one and handle the EM_SHOWBALLOONTIP message. Then just drag this control onto your form instead of the regular textbox control.
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();
}
}
这篇关于如何在文本框密码字段上禁用系统的大写锁定通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!