I am creating a custom control which is essentially a TextBox, but also includes a label.
I am mainly interested in the TextBox properties in the designer, so I am inheriting from TextBox.
Public Class LabelTextBox : Inherits System.Windows.Forms.TextBox
Protected m_lblLabel As System.Windows.Forms.Label
Public Sub New()
m_lblLabel = New System.Windows.Forms.Label()
End Sub
Private Sub LabelTextBox_HandleCreated(sender As Object, e As System.EventArgs) Handles Me.HandleCreated
m_lblLabel.Name = Me.Name + "_Label"
m_lblLabel.Text = "Default text..."
m_lblLabel.Left = Me.Left
m_lblLabel.Top = Me.Top - m_lblLabel.Height
Me.Parent.Controls.Add(m_lblLabel)
End Sub
Private Sub LabelTextBox_HandleDestroyed(sender As Object, e As System.EventArgs) Handles Me.HandleDestroyed
Me.Parent.Controls.Remove(m_lblLabel)
End Sub
End Class
My problem is that I want the "focus rectangle" in the designer to surround the textbox AND the label. I have tried to override the WIDTH and the HEIGHT and the BOUNDS properties, but nothing seems to work.
Please see the following images for a better understanding:
Image 1
Image 2
Which properties do I need to override to make the "focus rectangle" in the designer bigger? Also, what is the correct term for the "focus rectangle"?
I have searched the entire internet and could not find an answer, I sincerely hope someone can help me. Thank you.