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

时间:2014-08-23 09:11:05

标签: .net vb.net winforms textbox tooltip

在Winforms Textbox中,我定义了新的工具提示并对其进行了配置。但是,当大写锁定打开时,会显示两个工具提示。其中一个是我的,另一个是系统的默认工具提示通知。我只想展示我的工具提示。我想禁用系统的工具提示。我该如何禁用它?

1 个答案:

答案 0 :(得分:2)

我找到了答案here,并已将代码翻译成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