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

后端 未结 1 344
小蘑菇
小蘑菇 2021-01-28 09:42

In Winforms Textbox, I have defined new ToolTip and configured it. I have set the PasswordChar to \'*\'. However, when caps lock is on, tw

相关标签:
1条回答
  • 2021-01-28 09:52

    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();
        }
    }
    
    0 讨论(0)
提交回复
热议问题