关闭Caps Lock警告消息 [英] Turn off Caps Lock warning message

查看:118
本文介绍了关闭Caps Lock警告消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我有一个带有文本框"textbox1"的表单"form1". UseSystemPasswordChar = True,因为它将是一个密码字段.当我打开大写锁定时,会出现一条警告消息.我只想禁用这一个气球!

我有此代码,但是它不起作用!看来EM_SHOWBALLOONTIP的消息号不正确,但我找不到好消息.

Hi!

I have a form ''form1'' with a textbox ''textbox1''. UseSystemPasswordChar=True because it would be a password field. When I turn on caps lock a warning message appears. I want to disable ONLY this one balloon!

I have this code, but it doesn''t work! It looks like message number for EM_SHOWBALLOONTIP is not correct, but I can''t find the good one.

Public Delegate Sub DeActivateEventHandler()

Public Class Form1
    Private Const ECM_FIRST As Long = &H1500
    Private Const EM_SHOWBALLOONTIP As Long = (ECM_FIRST + 3)
    Public Event DeActivate As DeActivateEventHandler

    Protected Overrides Sub WndProc(ByRef m As Message)
        If m.Msg = EM_SHOWBALLOONTIP Then
            MsgBox("Jump")
            RaiseEvent DeActivate()
        Else
            MyBase.WndProc(m)
        End If
    End Sub
End Class





Could you help please?

推荐答案

将以下内容添加到文本框按下事件中

If e.KeyData = Keys.CapsLock Then e.SuppressKeyPress = True
Add the following to the textbox key down event

If e.KeyData = Keys.CapsLock Then e.SuppressKeyPress = True


如果在单击将显示消息的控件之前单击大写锁定,则此功能将无效
This won''t work if caps lock is already on before some one clicks on the control which will show the message


这篇关于关闭Caps Lock警告消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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