How to disable system's caps-lock notification on Textbox [duplicate]

半城伤御伤魂 提交于 2019-12-23 06:26:12

问题


In Winforms Textbox, I have defined new ToolTip and configured it. However, when caps lock is on, two tooltips are 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 ?


回答1:


I found an answer here, and have translated the code to VB.NET:

Public Class CustomMaskedTextBox
    Inherits MaskedTextBox

    Private m_DisableBalloonTips As Boolean
    Public Property DisableBalloonTips() As Boolean
        Get
            Return m_DisableBalloonTips
        End Get
        Set
            m_DisableBalloonTips = Value
        End Set
    End Property


    Protected Overrides Sub WndProc(ByRef m As Message)
        Private Const EM_SHOWBALLOONTIP As Integer = &H1503
        If m.Msg = EM_SHOWBALLOONTIP AndAlso DisableBalloonTips Then
            m.Result = IntPtr.Zero
            Return
        End If
        MyBase.WndProc(m)
    End Sub
End Class


来源:https://stackoverflow.com/questions/25460336/how-to-disable-systems-caps-lock-notification-on-textbox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!