如何禁用对文本框密码字段系统的大写锁定的通知 [英] how to disable System's caps-lock notification on textbox password field

查看:442
本文介绍了如何禁用对文本框密码字段系统的大写锁定的通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆