jj: Neues Control Linie, form Designer entschlacken
This commit is contained in:
@@ -15,13 +15,14 @@ Public Class ClassControlCreator
|
||||
Private Const DEFAULT_HEIGHT As Integer = 20
|
||||
Private Const DEFAULT_HEIGHT_TABLE As Integer = 150
|
||||
|
||||
Private Const PREFIX_TEXTBOX = "TXT"
|
||||
Private Const PREFIX_LABEL = "LBL"
|
||||
Private Const PREFIX_CHECKBOX = "CHK"
|
||||
Private Const PREFIX_COMBOBOX = "CMB"
|
||||
Private Const PREFIX_DATETIMEPICKER = "DTP"
|
||||
Private Const PREFIX_DATAGRIDVIEW = "DGV"
|
||||
Private Const PREFIX_TABLE = "TB"
|
||||
Public Const PREFIX_TEXTBOX = "TXT"
|
||||
Public Const PREFIX_LABEL = "LBL"
|
||||
Public Const PREFIX_CHECKBOX = "CHK"
|
||||
Public Const PREFIX_COMBOBOX = "CMB"
|
||||
Public Const PREFIX_DATETIMEPICKER = "DTP"
|
||||
Public Const PREFIX_DATAGRIDVIEW = "DGV"
|
||||
Public Const PREFIX_TABLE = "TB"
|
||||
Public Const PREFIX_LINE = "LINE"
|
||||
|
||||
''' <summary>
|
||||
''' Standard Eigenschaften für alle Controls
|
||||
@@ -57,7 +58,7 @@ Public Class ClassControlCreator
|
||||
}
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateBaseControl(ctrl As Control, row As DataRow) As Control
|
||||
Public Shared Function CreateBaseControl(ctrl As Control, row As DataRow, designMode As Boolean) As Control
|
||||
Dim props As ControlDBProps = TransformDataRow(row)
|
||||
|
||||
ctrl.Tag = props.Guid
|
||||
@@ -66,6 +67,10 @@ Public Class ClassControlCreator
|
||||
ctrl.Font = props.Font
|
||||
ctrl.ForeColor = props.Color
|
||||
|
||||
If designMode Then
|
||||
ctrl.Cursor = Cursors.Hand
|
||||
End If
|
||||
|
||||
Return ctrl
|
||||
End Function
|
||||
|
||||
@@ -155,6 +160,7 @@ Public Class ClassControlCreator
|
||||
.Name = $"{PREFIX_TABLE}_{clsTools.ShortGUID}",
|
||||
.Size = New Size(DEFAULT_WIDTH, DEFAULT_HEIGHT_TABLE),
|
||||
.Cursor = Cursors.Hand,
|
||||
.Location = location,
|
||||
.AllowUserToAddRows = False,
|
||||
.AllowUserToDeleteRows = False,
|
||||
.AllowUserToResizeColumns = False,
|
||||
@@ -174,13 +180,22 @@ Public Class ClassControlCreator
|
||||
Return control
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateNewLine(location As Point) As LineLabel
|
||||
Dim control As New LineLabel With {
|
||||
.Name = $"{PREFIX_LINE}_{clsTools.ShortGUID}",
|
||||
.Text = "---------------------------------",
|
||||
.Location = location
|
||||
}
|
||||
|
||||
Return control
|
||||
End Function
|
||||
|
||||
' ----------------------- EXISITING CONTROLS -----------------------
|
||||
|
||||
Public Shared Function CreateExistingTextbox(row As DataRow, designMode As Boolean) As TextBox
|
||||
Dim control As TextBox = CreateBaseControl(New TextBox(), row)
|
||||
Dim control As TextBox = CreateBaseControl(New TextBox(), row, designMode)
|
||||
|
||||
control.BackColor = Color.White
|
||||
control.Cursor = Cursors.Hand
|
||||
|
||||
If row.Item("HEIGHT") > 27 Then
|
||||
control.Multiline = True
|
||||
@@ -202,19 +217,17 @@ Public Class ClassControlCreator
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateExistingLabel(row As DataRow, designMode As Boolean) As Label
|
||||
Dim control As Label = CreateBaseControl(New Label(), row)
|
||||
Dim control As Label = CreateBaseControl(New Label(), row, designMode)
|
||||
|
||||
control.Text = row.Item("CTRL_TEXT")
|
||||
control.AutoSize = True
|
||||
control.Cursor = Cursors.Hand
|
||||
|
||||
Return control
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateExistingCombobox(row As DataRow, designMode As Boolean) As ComboBox
|
||||
Dim control As ComboBox = CreateBaseControl(New ComboBox(), row)
|
||||
Dim control As ComboBox = CreateBaseControl(New ComboBox(), row, designMode)
|
||||
|
||||
control.Cursor = Cursors.Hand
|
||||
control.Size = New Size(row.Item("WIDTH"), row.Item("HEIGHT"))
|
||||
|
||||
If Not designMode Then
|
||||
@@ -230,9 +243,8 @@ Public Class ClassControlCreator
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateExistingDatepicker(row As DataRow, designMode As Boolean) As DateTimePicker
|
||||
Dim control As DateTimePicker = CreateBaseControl(New DateTimePicker(), row)
|
||||
Dim control As DateTimePicker = CreateBaseControl(New DateTimePicker(), row, designMode)
|
||||
|
||||
control.Cursor = Cursors.Hand
|
||||
control.Size = New Size(row.Item("WIDTH"), row.Item("HEIGHT"))
|
||||
control.Format = DateTimePickerFormat.Short
|
||||
|
||||
@@ -245,20 +257,18 @@ Public Class ClassControlCreator
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateExisingCheckbox(row As DataRow, designMode As Boolean) As CheckBox
|
||||
Dim control As CheckBox = CreateBaseControl(New CheckBox(), row)
|
||||
Dim control As CheckBox = CreateBaseControl(New CheckBox(), row, designMode)
|
||||
|
||||
control.AutoSize = True
|
||||
control.Text = row.Item("CTRL_TEXT")
|
||||
control.Cursor = Cursors.Hand
|
||||
|
||||
Return control
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateExistingDataGridView(row As DataRow, designMode As Boolean) As DataGridView
|
||||
Dim control As DataGridView = CreateBaseControl(New DataGridView(), row)
|
||||
Dim control As DataGridView = CreateBaseControl(New DataGridView(), row, designMode)
|
||||
|
||||
control.Size = New Size(row.Item("WIDTH"), row.Item("HEIGHT"))
|
||||
control.Cursor = Cursors.Hand
|
||||
control.AllowUserToAddRows = False
|
||||
control.AllowUserToDeleteRows = False
|
||||
control.AllowUserToResizeColumns = False
|
||||
@@ -275,10 +285,9 @@ Public Class ClassControlCreator
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateExistingTable(row As DataRow, columns As List(Of DD_DMSLiteDataSet.TBPM_CONTROL_TABLERow), designMode As Boolean) As DataGridView
|
||||
Dim control As DataGridView = CreateBaseControl(New DataGridView(), row)
|
||||
Dim control As DataGridView = CreateBaseControl(New DataGridView(), row, designMode)
|
||||
|
||||
control.Size = New Size(row.Item("WIDTH"), row.Item("HEIGHT"))
|
||||
control.Cursor = Cursors.Hand
|
||||
control.AllowUserToAddRows = False
|
||||
control.AllowUserToDeleteRows = False
|
||||
control.AllowUserToResizeColumns = False
|
||||
@@ -297,4 +306,31 @@ Public Class ClassControlCreator
|
||||
Return control
|
||||
End Function
|
||||
|
||||
Public Shared Function CreateExistingLine(row As DataRow, designMode As Boolean) As LineLabel
|
||||
Dim control As LineLabel = CreateBaseControl(New LineLabel(), row, designMode)
|
||||
control.Text = "------------------------------"
|
||||
control.BorderStyle = BorderStyle.None
|
||||
control.AutoSize = False
|
||||
control.BackColor = IntToColor(NotNull(row.Item("FONT_COLOR"), DEFAULT_COLOR))
|
||||
control.Size = New Size(row.Item("WIDTH"), row.Item("HEIGHT"))
|
||||
|
||||
Return control
|
||||
End Function
|
||||
|
||||
|
||||
' ----------------------- CUSTOM LABEL/LINE CLASS -----------------------
|
||||
|
||||
Public Class LineLabel
|
||||
Inherits Label
|
||||
|
||||
Protected Overrides Sub OnPaint(e As PaintEventArgs)
|
||||
'MyBase.OnPaint(e)
|
||||
|
||||
Dim size As New Size(e.ClipRectangle.Width, 2)
|
||||
Dim rect As New Rectangle(New Point(0, 0), size)
|
||||
|
||||
'ControlPaint.DrawBorder(e.Graphics, rect, Me.ForeColor, ButtonBorderStyle.Solid)
|
||||
e.Graphics.DrawLine(New Pen(ForeColor, 100), New Point(0, 0), New Point(e.ClipRectangle.Width, 2))
|
||||
End Sub
|
||||
End Class
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user