how to disable System#39;s caps-lock notification on textbox password field(如何在文本框密码字段上禁用系统的大写锁定通知)
问题描述
在 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();
}
}
这篇关于如何在文本框密码字段上禁用系统的大写锁定通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在文本框密码字段上禁用系统的大写锁定通知
- CanBeNull和ReSharper-将其用于异步任务? 2022-01-01
- 是否可以在 .Net 3.5 中进行通用控件? 2022-01-01
- 在 LINQ to SQL 中使用 contains() 2022-01-01
- Azure Active Directory 与 MVC,客户端和资源标识同一 2022-01-01
- Windows 喜欢在 LINUX 中使用 MONO 进行服务开发? 2022-01-01
- 为什么 C# 中的堆栈大小正好是 1 MB? 2022-01-01
- C# 通过连接字符串检索正确的 DbConnection 对象 2022-01-01
- 带问号的 nvarchar 列结果 2022-01-01
- 使用 rss + c# 2022-01-01
- 在 C# 中异步处理项目队列 2022-01-01
