Hi, I actually use ToolStripEx with many ToolStripButton, but now I need to add a new command (collapse gri up to level) that needs an input by the user --> It would be great to let the user type the value directly in toolstrip instead of displaying a for with just an edit-box and ok button.
I tried to do this but I cannot use ToolStripButton + TextBox, I need to use ToolStripButton in order to keep my old code related to image alignment, Checked property,...
Here my class
Imports System.Windows.Forms
Imports System.Drawing
Imports Syncfusion.Windows.Forms
Public Class ButtonTextBoxToolStripItem
Inherits ToolStripControlHost
Public Sub New()
MyBase.New(New ButtonTextBoxControlPanel)
End Sub
Public ReadOnly Property ControlPanelControl() As ButtonTextBoxControlPanel
Get
Return CType(Me.Control, ButtonTextBoxControlPanel)
End Get
End Property
Public ReadOnly Property Button() As Button 'ToolStripButton
Get
Return Me.ControlPanelControl().btn
End Get
End Property
Public Property Checked As Boolean
Get
'Return Me.ControlPanelControl.btn.Checked
Return False
End Get
Set(value As Boolean)
'Me.ControlPanelControl.btn.Checked = value;
End Set
End Property
End Class
Public Class ButtonTextBoxControlPanel
Inherits Panel
Friend WithEvents btn As New Button 'Button 'ToolStripButton
Friend WithEvents txt As New TextBox
Public Sub New()
btn.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Bottom
'lbl.Text = "Test"
btn.TextAlign = ContentAlignment.MiddleLeft
btn.AutoSize = True
btn.Height = Me.Height
'btn.Size = New Size(30, Me.Height)
btn.Location = New Point(0, 0)
btn.Parent = Me
txt.Anchor = AnchorStyles.Left Or AnchorStyles.Right Or AnchorStyles.Top
txt.Height = Me.Height
txt.Location = New Point(btn.Bounds.Right, btn.Bounds.Top)
txt.Width = Me.Width - txt.Left
txt.Parent = Me
End Sub
End Class