kriswinner
Member
- Joined
- Apr 23, 2009
- Messages
- 23
- Programming Experience
- 10+
Is it possible to have a label precede a toolstriptextbox?
If so...how?
If so...how?
Public Class ToolStripTextBoxWithLabel
Inherits ToolStripControlHost
Public Sub New(Optional ByVal lblText As String = "label")
MyBase.New(New ControlPanel(lblText))
End Sub
Public ReadOnly Property ControlPanelControl() As ControlPanel
Get
Return CType(Me.Control, ControlPanel)
End Get
End Property
End Class
Public Class ControlPanel
Inherits Panel
Friend WithEvents txt As New TextBox
Friend WithEvents lbl As New Label
Public Sub New(ByVal lblText As String)
Me.Height = 20
lbl.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Bottom
lbl.Text = lblText
lbl.TextAlign = ContentAlignment.BottomLeft
lbl.AutoSize = True
lbl.Height = Me.Height
lbl.Location = New Point(0, 3)
lbl.Parent = Me
txt.Anchor = AnchorStyles.Left Or AnchorStyles.Right Or AnchorStyles.Top
txt.Location = New Point(lbl.Right + 3, 0)
txt.Width = Me.Width - txt.Left
txt.Parent = Me
End Sub
End Class
Dim tb_LicenseKey As New ToolStripTextBoxWithLabel("License Key:")
tb_LicenseKey.Name = "tb_LicenseKey"
OptionMenu.DropDownItems.Add(New ToolStripSeparator)
OptionMenu.DropDownItems.Add(tb_LicenseKey)
tb_LicenseKey.BackColor = Color.FromArgb(246, 246, 246)