我有一个允许ToolStrip具有NumericUpDown的类。我添加了一个属性(值,最小值和最大值)。它正在工作,但是由于添加了Value属性,因此我想删除Text属性。有办法吗?
Please see image where you can see the designer properties
下面是课程
<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