51 lines
1.2 KiB
VB.net
51 lines
1.2 KiB
VB.net
Public Class ClassControlBuilder
|
|
#Region "State"
|
|
Private _DesignMode As Boolean
|
|
#End Region
|
|
|
|
#Region "Constants"
|
|
Private DEFAULT_SIZE As Size = New Size(200, 27)
|
|
|
|
Private DEFAULT_TEXT As String = "Unnamed Control"
|
|
#End Region
|
|
|
|
Public Sub New(DesignMode As Boolean)
|
|
_DesignMode = DesignMode
|
|
End Sub
|
|
|
|
Private Function GetRandomControlName(Name As String)
|
|
Return $"{Name}-{ClassUtils.ShortGUID()}"
|
|
End Function
|
|
|
|
Public Function CreateLabel() As Label
|
|
Dim Metadata As New ClassControlUtils.ControlMetadata() With {
|
|
.Id = 4711
|
|
}
|
|
|
|
Dim oLabel As New Label() With {
|
|
.Name = GetRandomControlName("Label"),
|
|
.Text = DEFAULT_TEXT,
|
|
.AutoSize = False,
|
|
.Size = DEFAULT_SIZE,
|
|
.Tag = Metadata
|
|
}
|
|
|
|
Return oLabel
|
|
End Function
|
|
|
|
Public Function CreateTextbox() As TextBox
|
|
Dim Metadata As New ClassControlUtils.ControlMetadata() With {
|
|
.Id = 4711
|
|
}
|
|
|
|
Dim oTextbox As New TextBox() With {
|
|
.Name = GetRandomControlName("Textbox"),
|
|
.Size = DEFAULT_SIZE,
|
|
.Tag = Metadata
|
|
}
|
|
|
|
Return oTextbox
|
|
End Function
|
|
|
|
End Class
|