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();
}
}
这篇关于如何在文本框密码字段上禁用系统的大写锁定通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在文本框密码字段上禁用系统的大写锁定通知
基础教程推荐
- 全局 ASAX - 获取服务器名称 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
