VB ToolStripControlHost удалить свойство Text - PullRequest
0 голосов
/ 05 июля 2018

У меня есть класс, который позволяет ToolStrip иметь NumericUpDown. Я добавил свойства (значение, минимум и максимум). Это работает, но я хочу удалить свойство Text, так как я добавил свойство Value. Есть ли способ сделать это?

Пожалуйста, смотрите изображение, где вы можете увидеть свойства дизайнера

Ниже приведен класс

<Windows.Forms.Design.ToolStripItemDesignerAvailabilityAttribute(Windows.Forms.Design.ToolStripItemDesignerAvailability.ToolStrip), DebuggerStepThrough()>
Public Class ToolStripNumericUpDown
    Inherits Windows.Forms.ToolStripControlHost

    Public Sub New()
        MyBase.New(New System.Windows.Forms.NumericUpDown())
    End Sub

    Public ReadOnly Property ToolStripNumericUpDownControl() As Windows.Forms.NumericUpDown
        Get
            Return TryCast(Control, Windows.Forms.NumericUpDown)
        End Get
    End Property

    Public Property Value() As Long
        Get
            Return ToolStripNumericUpDownControl.Value
        End Get
        Set(ByVal value As Long)
            ToolStripNumericUpDownControl.Value = value
        End Set
    End Property

    Public Property Minimum() As Long
        Get
            Return ToolStripNumericUpDownControl.Minimum
        End Get
        Set(ByVal value As Long)
            ToolStripNumericUpDownControl.Minimum = value
        End Set
    End Property

    Public Property Maximum() As Long
        Get
            Return ToolStripNumericUpDownControl.Maximum
        End Get
        Set(ByVal value As Long)
            ToolStripNumericUpDownControl.Maximum = value
        End Set
    End Property

    Protected Overrides Sub OnSubscribeControlEvents(ByVal c As Windows.Forms.Control)
        MyBase.OnSubscribeControlEvents(c)
        AddHandler DirectCast(c, Windows.Forms.NumericUpDown).ValueChanged, AddressOf OnValueChanged
    End Sub

    Protected Overrides Sub OnUnsubscribeControlEvents(ByVal c As Windows.Forms.Control)
        MyBase.OnUnsubscribeControlEvents(c)
        RemoveHandler DirectCast(c, Windows.Forms.NumericUpDown).ValueChanged, AddressOf OnValueChanged
    End Sub

    Public Event ValueChanged As EventHandler

    Private Sub OnValueChanged(ByVal sender As Object, ByVal e As EventArgs)
        RaiseEvent ValueChanged(Me, e)
    End Sub
End Class
...