2019-03-04 17:13:49 +01:00

71 lines
1.8 KiB
VB.net

Imports DigitalData.Controls.LookupGrid
Imports DigitalData.GUIs.ClientSuite.ClassControlUtils
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 ControlMetadata() With {
.Id = 4711,
.Type = ControlType.Label
}
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 ControlMetadata() With {
.Id = 4711,
.Type = ControlType.TextBox
}
Dim oTextbox As New TextBox() With {
.Name = GetRandomControlName("Textbox"),
.Size = DEFAULT_SIZE,
.Tag = Metadata
}
Return oTextbox
End Function
Public Function CreateCombobox() As LookupControl
Dim Metadata As New ControlMetadata() With {
.Id = 4711,
.Type = ControlType.Combobox
}
Dim oCombobox As New LookupControl() With {
.Name = GetRandomControlName("Combobox"),
.Size = DEFAULT_SIZE,
.Tag = Metadata
}
Return oCombobox
End Function
End Class