如何禁用对文本框密码字段系统的大写锁定的通知 [英] how to disable System's caps-lock notification on textbox password field
问题描述
在的WinForms 文本框
,我已经定义了新的工具提示
并进行配置。我已经设置了 PasswordChar
来'*'。然而,当大写锁定,两个提示
所示。其中之一是我,另一个是系统的默认提示
的通知。我只是想表明我的提示
。我想禁用系统的提示
。如何禁用呢?
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?
推荐答案
的一种方法是从现有的派生自己的TextBox控件和处理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();
}
}
这篇关于如何禁用对文本框密码字段系统的大写锁定的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!