cihadakt
cihadakt

Reputation: 3214

how to disable System's caps-lock notification on textbox password field

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?

Upvotes: 0

Views: 1621

Answers (1)

dazedandconfused
dazedandconfused

Reputation: 3186

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

Upvotes: 1

Related Questions