如何在文本框密码字段上禁用系统的大写锁定通知

11

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

问题描述

在 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();
    }
}

这篇关于如何在文本框密码字段上禁用系统的大写锁定通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

C# 中的多播委托奇怪行为?
Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)...
2023-11-11 C#/.NET开发问题
6

参数计数与调用不匹配?
Parameter count mismatch with Invoke?(参数计数与调用不匹配?)...
2023-11-11 C#/.NET开发问题
26

如何将代表存储在列表中
How to store delegates in a List(如何将代表存储在列表中)...
2023-11-11 C#/.NET开发问题
6

代表如何工作(在后台)?
How delegates work (in the background)?(代表如何工作(在后台)?)...
2023-11-11 C#/.NET开发问题
5

没有 EndInvoke 的 C# 异步调用?
C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)...
2023-11-11 C#/.NET开发问题
2

Delegate.CreateDelegate() 和泛型:错误绑定到目标方法
Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)...
2023-11-11 C#/.NET开发问题
14