MS05082016
This commit is contained in:
@@ -23,10 +23,15 @@ Public Class ClassRecordView
|
||||
''' Lädt die Controls und Werte für die angegebene RecordId
|
||||
''' </summary>
|
||||
Public Sub LoadRecord(recordId As Integer)
|
||||
Me.RecordId = recordId
|
||||
Me.LoadControls()
|
||||
Me.LoadValues(Me.Panel.Controls)
|
||||
Me.PreventControlValueChanges()
|
||||
Try
|
||||
Me.RecordId = recordId
|
||||
Me.LoadControls()
|
||||
Me.LoadValues(Me.Panel.Controls)
|
||||
Me.PreventControlValueChanges()
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -42,27 +47,32 @@ Public Class ClassRecordView
|
||||
End Function
|
||||
|
||||
Private Function MapRowToProps(r As DataRow) As ControlProps
|
||||
Dim props As New ControlProps
|
||||
Try
|
||||
Dim props As New ControlProps
|
||||
|
||||
props.Id = r.Item("CONTROL_ID")
|
||||
props.Name = r.Item("CONTROL_NAME").ToString
|
||||
props.Type = r.Item("CTRLTYPE_NAME").ToString
|
||||
props.Caption = r.Item("CTRLSCR_CAPTION").ToString
|
||||
props.X = r.Item("CTRLSCR_X_LOC")
|
||||
props.Y = r.Item("CTRLSCR_Y_LOC")
|
||||
props.Height = r.Item("CTRLSCR_HEIGHT")
|
||||
props.Width = r.Item("CTRLSCR_WIDTH")
|
||||
props.FontFamily = r.Item("CTRLSCR_FONT_FAMILY")
|
||||
props.FontSize = r.Item("CTRLSCR_FONT_SIZE")
|
||||
props.FontStyle = CType(r.Item("CTRLSCR_FONT_STYLE"), FontStyle)
|
||||
props.FontColor = IntToColor(r.Item("CTRLSCR_FONT_COLOR"))
|
||||
props.BackColor = IntToColor(r.Item("CTRLSCR_BACK_COLOR"))
|
||||
props.Font = New Font(props.FontFamily, props.FontSize, props.FontStyle)
|
||||
props.SqlCommand1 = r.Item("CONTROL_SQLCOMMAND_1").ToString()
|
||||
props.SqlCommand2 = r.Item("CONTROL_SQLCOMMAND_2").ToString()
|
||||
props.StaticList = r.Item("CONTROL_STATIC_LIST").ToString()
|
||||
props.Id = r.Item("CONTROL_ID")
|
||||
props.Name = r.Item("CONTROL_NAME").ToString
|
||||
props.Type = r.Item("CTRLTYPE_NAME").ToString
|
||||
props.Caption = r.Item("CTRLSCR_CAPTION").ToString
|
||||
props.X = r.Item("CTRLSCR_X_LOC")
|
||||
props.Y = r.Item("CTRLSCR_Y_LOC")
|
||||
props.Height = r.Item("CTRLSCR_HEIGHT")
|
||||
props.Width = r.Item("CTRLSCR_WIDTH")
|
||||
props.FontFamily = r.Item("CTRLSCR_FONT_FAMILY")
|
||||
props.FontSize = r.Item("CTRLSCR_FONT_SIZE")
|
||||
props.FontStyle = CType(r.Item("CTRLSCR_FONT_STYLE"), FontStyle)
|
||||
props.FontColor = IntToColor(r.Item("CTRLSCR_FONT_COLOR"))
|
||||
props.BackColor = IntToColor(r.Item("CTRLSCR_BACK_COLOR"))
|
||||
props.Font = New Font(props.FontFamily, props.FontSize, props.FontStyle)
|
||||
props.SqlCommand1 = r.Item("CONTROL_SQLCOMMAND_1").ToString()
|
||||
props.SqlCommand2 = r.Item("CONTROL_SQLCOMMAND_2").ToString()
|
||||
props.StaticList = r.Item("CONTROL_STATIC_LIST").ToString()
|
||||
|
||||
Return props
|
||||
Return props
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
@@ -72,11 +82,16 @@ Public Class ClassRecordView
|
||||
''' <param name="props">Das Eigenschaften Objekt</param>
|
||||
''' <returns>Das Control mit den allgemeinen Eigenschaften</returns>
|
||||
Private Function SetBaseProps(c As Control, props As ControlProps)
|
||||
c.Location = New Point(props.X, props.Y)
|
||||
c.Width = props.Width
|
||||
c.Height = props.Height
|
||||
c.Tag = props
|
||||
Return c
|
||||
Try
|
||||
c.Location = New Point(props.X, props.Y)
|
||||
c.Width = props.Width
|
||||
c.Height = props.Height
|
||||
c.Tag = props
|
||||
Return c
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
@@ -173,183 +188,203 @@ Public Class ClassRecordView
|
||||
#End Region
|
||||
|
||||
Private Sub LoadControls()
|
||||
Dim controls As New List(Of Control)
|
||||
DTControls = ClassDatabase.Return_Datatable(String.Format("SELECT * FROM VWPMO_CONTROL_SCREEN WHERE FORM_ID = {0}", GetEntityId()))
|
||||
Try
|
||||
Dim controls As New List(Of Control)
|
||||
DTControls = ClassDatabase.Return_Datatable(String.Format("SELECT * FROM VWPMO_CONTROL_SCREEN WHERE FORM_ID = {0}", GetEntityId()))
|
||||
|
||||
For Each row As DataRow In DTControls.Rows
|
||||
Dim props As ControlProps = MapRowToProps(row)
|
||||
Dim control As Control = Nothing
|
||||
For Each row As DataRow In DTControls.Rows
|
||||
Dim props As ControlProps = MapRowToProps(row)
|
||||
Dim control As Control = Nothing
|
||||
|
||||
Select Case props.Type
|
||||
Case "Label"
|
||||
control = LoadLabel(props)
|
||||
Case "Textbox"
|
||||
control = LoadTextBox(props)
|
||||
Case "Combobox"
|
||||
control = LoadCombobox(props)
|
||||
Case "Datepicker"
|
||||
control = LoadDatePicker(props)
|
||||
Case "Datagridview"
|
||||
control = LoadDataGridView(props)
|
||||
Case "ListBox"
|
||||
control = LoadListBox(props)
|
||||
Case "CheckedListBox"
|
||||
control = LoadCheckedListBox(props)
|
||||
Case "Checkbox"
|
||||
control = LoadCheckBox(props)
|
||||
Case "Radiobutton"
|
||||
control = LoadRadioButton(props)
|
||||
Case "Picturebox"
|
||||
control = LoadPictureBox(props)
|
||||
End Select
|
||||
Select Case props.Type
|
||||
Case "Label"
|
||||
control = LoadLabel(props)
|
||||
Case "Textbox"
|
||||
control = LoadTextBox(props)
|
||||
Case "Combobox"
|
||||
control = LoadCombobox(props)
|
||||
Case "Datepicker"
|
||||
control = LoadDatePicker(props)
|
||||
Case "Datagridview"
|
||||
control = LoadDataGridView(props)
|
||||
Case "ListBox"
|
||||
control = LoadListBox(props)
|
||||
Case "CheckedListBox"
|
||||
control = LoadCheckedListBox(props)
|
||||
Case "Checkbox"
|
||||
control = LoadCheckBox(props)
|
||||
Case "Radiobutton"
|
||||
control = LoadRadioButton(props)
|
||||
Case "Picturebox"
|
||||
control = LoadPictureBox(props)
|
||||
End Select
|
||||
|
||||
If control IsNot Nothing Then
|
||||
controls.Add(control)
|
||||
End If
|
||||
Next
|
||||
If control IsNot Nothing Then
|
||||
controls.Add(control)
|
||||
End If
|
||||
Next
|
||||
|
||||
Me.Panel.Controls.Clear()
|
||||
Me.Panel.Controls.AddRange(controls.ToArray())
|
||||
Me.Panel.Controls.Clear()
|
||||
Me.Panel.Controls.AddRange(controls.ToArray())
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub PreventControlValueChanges()
|
||||
Try
|
||||
For Each c As Control In Me.Panel.Controls
|
||||
Dim type As String = DirectCast(c.Tag, ControlProps).Type
|
||||
|
||||
For Each c As Control In Me.Panel.Controls
|
||||
Dim type As String = DirectCast(c.Tag, ControlProps).Type
|
||||
If type = "CheckedListBox" Then
|
||||
Dim checklistbox = DirectCast(c, CheckedListBoxControl)
|
||||
AddHandler checklistbox.ItemChecking, Sub(sender As Object, e As DevExpress.XtraEditors.Controls.ItemCheckingEventArgs)
|
||||
e.Cancel = True
|
||||
End Sub
|
||||
End If
|
||||
|
||||
If type = "CheckedListBox" Then
|
||||
Dim checklistbox = DirectCast(c, CheckedListBoxControl)
|
||||
AddHandler checklistbox.ItemChecking, Sub(sender As Object, e As DevExpress.XtraEditors.Controls.ItemCheckingEventArgs)
|
||||
e.Cancel = True
|
||||
End Sub
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
|
||||
Next
|
||||
End Try
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub LoadValues(controlCollection As Control.ControlCollection)
|
||||
Dim controls As New List(Of Control)
|
||||
DTValues = ClassDatabase.Return_Datatable(String.Format("SELECT * FROM VWPMO_VALUES WHERE RECORD_ID = {0}", Me.RecordId))
|
||||
Try
|
||||
Dim controls As New List(Of Control)
|
||||
DTValues = ClassDatabase.Return_Datatable(String.Format("SELECT * FROM VWPMO_VALUES WHERE RECORD_ID = {0}", Me.RecordId))
|
||||
|
||||
' ControlCollection in eine List<Of Control> konvertieren
|
||||
controls = controlCollection.Cast(Of Control)().ToList()
|
||||
' ControlCollection in eine List<Of Control> konvertieren
|
||||
controls = controlCollection.Cast(Of Control)().ToList()
|
||||
|
||||
For Each control As Control In controls
|
||||
Dim controlId As Integer = DirectCast(control.Tag, ControlProps).Id
|
||||
Dim controlType As String = DirectCast(control.Tag, ControlProps).Type
|
||||
For Each control As Control In controls
|
||||
Dim controlId As Integer = DirectCast(control.Tag, ControlProps).Id
|
||||
Dim controlType As String = DirectCast(control.Tag, ControlProps).Type
|
||||
|
||||
Dim values As List(Of Object) = (From row In DTValues.AsEnumerable()
|
||||
Where row.Item("CONTROL_ID") = controlId
|
||||
Select row.Item("VALUE")).ToList()
|
||||
Dim values As List(Of Object) = (From row In DTValues.AsEnumerable()
|
||||
Where row.Item("CONTROL_ID") = controlId
|
||||
Select row.Item("VALUE")).ToList()
|
||||
|
||||
' Wenn kein Wert existiert, keinen Wert laden
|
||||
If values.Count = 0 And Not controlType = "Picturebox" Then
|
||||
Continue For
|
||||
Else
|
||||
LoadValue(control, values)
|
||||
End If
|
||||
Next
|
||||
' Wenn kein Wert existiert, keinen Wert laden
|
||||
If values.Count = 0 And Not controlType = "Picturebox" Then
|
||||
Continue For
|
||||
Else
|
||||
LoadValue(control, values)
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Public Sub LoadValue(control As Control, values As List(Of Object))
|
||||
Dim controlType As String = DirectCast(control.Tag, ControlProps).Type
|
||||
Dim value = Nothing
|
||||
If values.Count > 0 Then
|
||||
value = values(0)
|
||||
End If
|
||||
Try
|
||||
Dim controlType As String = DirectCast(control.Tag, ControlProps).Type
|
||||
Dim value = Nothing
|
||||
If values.Count > 0 Then
|
||||
value = values(0)
|
||||
End If
|
||||
|
||||
Select Case controlType
|
||||
Case "Label"
|
||||
' Hier muss kein Wert geladen werden
|
||||
Exit Select
|
||||
Case "Textbox"
|
||||
DirectCast(control, TextBox).Text = value.ToString()
|
||||
Case "Combobox"
|
||||
DirectCast(control, TextBox).Text = value.ToString()
|
||||
Case "Datepicker"
|
||||
Dim dtp As TextBox = DirectCast(control, TextBox)
|
||||
Try
|
||||
dtp.Text = DateTime.Parse(value).ToShortDateString()
|
||||
Catch ex As Exception
|
||||
dtp.text = "Invalid Date"
|
||||
End Try
|
||||
Select Case controlType
|
||||
Case "Label"
|
||||
' Hier muss kein Wert geladen werden
|
||||
Exit Select
|
||||
Case "Textbox"
|
||||
DirectCast(control, TextBox).Text = value.ToString()
|
||||
Case "Combobox"
|
||||
DirectCast(control, TextBox).Text = value.ToString()
|
||||
Case "Datepicker"
|
||||
Dim dtp As TextBox = DirectCast(control, TextBox)
|
||||
Try
|
||||
dtp.Text = DateTime.Parse(value).ToShortDateString()
|
||||
Catch ex As Exception
|
||||
dtp.Text = "Invalid Date"
|
||||
End Try
|
||||
|
||||
Case "Checkbox"
|
||||
Dim checkbox = DirectCast(control, CheckBox)
|
||||
Try
|
||||
checkbox.Checked = Boolean.Parse(value)
|
||||
Catch ex As Exception
|
||||
checkbox.Checked = False
|
||||
End Try
|
||||
Case "Checkbox"
|
||||
Dim checkbox = DirectCast(control, CheckBox)
|
||||
Try
|
||||
checkbox.Checked = Boolean.Parse(value)
|
||||
Catch ex As Exception
|
||||
checkbox.Checked = False
|
||||
End Try
|
||||
|
||||
Case "RadioButton"
|
||||
Dim radio = DirectCast(control, RadioButton)
|
||||
Try
|
||||
radio.Checked = Boolean.Parse(value)
|
||||
Catch ex As Exception
|
||||
radio.Checked = False
|
||||
End Try
|
||||
Case "RadioButton"
|
||||
Dim radio = DirectCast(control, RadioButton)
|
||||
Try
|
||||
radio.Checked = Boolean.Parse(value)
|
||||
Catch ex As Exception
|
||||
radio.Checked = False
|
||||
End Try
|
||||
|
||||
Case "Datagridview"
|
||||
Try
|
||||
Dim datagridview As ListBoxControl = DirectCast(control, ListBoxControl)
|
||||
datagridview.Items.AddRange(values.ToArray())
|
||||
Catch ex As Exception
|
||||
' Keine Items hinzufügen
|
||||
End Try
|
||||
Case "Datagridview"
|
||||
Try
|
||||
Dim datagridview As ListBoxControl = DirectCast(control, ListBoxControl)
|
||||
datagridview.Items.AddRange(values.ToArray())
|
||||
Catch ex As Exception
|
||||
' Keine Items hinzufügen
|
||||
End Try
|
||||
|
||||
Case "ListBox"
|
||||
Try
|
||||
Dim listbox As ListBoxControl = DirectCast(control, ListBoxControl)
|
||||
listbox.Items.AddRange(values.ToArray())
|
||||
Catch ex As Exception
|
||||
' Keine Items hinzufügen
|
||||
End Try
|
||||
Case "ListBox"
|
||||
Try
|
||||
Dim listbox As ListBoxControl = DirectCast(control, ListBoxControl)
|
||||
listbox.Items.AddRange(values.ToArray())
|
||||
Catch ex As Exception
|
||||
' Keine Items hinzufügen
|
||||
End Try
|
||||
|
||||
Case "CheckedListBox"
|
||||
Try
|
||||
Dim checkedlist As CheckedListBoxControl = DirectCast(control, CheckedListBoxControl)
|
||||
For Each v As String In values
|
||||
Dim posBefore As Integer = 0
|
||||
While (checkedlist.FindStringExact(v, posBefore) > -1)
|
||||
Dim pos = checkedlist.FindStringExact(v, posBefore)
|
||||
' Wenn v gefunden wurde, anhaken
|
||||
If pos >= 0 Then
|
||||
checkedlist.SetItemCheckState(pos, CheckState.Checked)
|
||||
posBefore = pos + 1
|
||||
End If
|
||||
' Verhindere Endlosschleife
|
||||
If pos = 100 Then
|
||||
Exit While
|
||||
End If
|
||||
End While
|
||||
Next
|
||||
Catch ex As Exception
|
||||
' Keine Items anchecken
|
||||
End Try
|
||||
Case "Picturebox"
|
||||
Try
|
||||
Dim pb As PictureBox = DirectCast(control, PictureBox)
|
||||
Dim controlId As Integer = DirectCast(control.Tag, ControlProps).Id
|
||||
Dim sql = String.Format("SELECT IMG FROM TBPMO_CONTROL_IMAGE WHERE RECORD_ID = {0} AND CONTROL_ID = {1}", Me.RecordId, controlId)
|
||||
Dim bimg() As Byte = ClassDatabase.Execute_Scalar(sql)
|
||||
Case "CheckedListBox"
|
||||
Try
|
||||
Dim checkedlist As CheckedListBoxControl = DirectCast(control, CheckedListBoxControl)
|
||||
For Each v As String In values
|
||||
Dim posBefore As Integer = 0
|
||||
While (checkedlist.FindStringExact(v, posBefore) > -1)
|
||||
Dim pos = checkedlist.FindStringExact(v, posBefore)
|
||||
' Wenn v gefunden wurde, anhaken
|
||||
If pos >= 0 Then
|
||||
checkedlist.SetItemCheckState(pos, CheckState.Checked)
|
||||
posBefore = pos + 1
|
||||
End If
|
||||
' Verhindere Endlosschleife
|
||||
If pos = 100 Then
|
||||
Exit While
|
||||
End If
|
||||
End While
|
||||
Next
|
||||
Catch ex As Exception
|
||||
' Keine Items anchecken
|
||||
End Try
|
||||
Case "Picturebox"
|
||||
Try
|
||||
Dim pb As PictureBox = DirectCast(control, PictureBox)
|
||||
Dim controlId As Integer = DirectCast(control.Tag, ControlProps).Id
|
||||
Dim sql = String.Format("SELECT IMG FROM TBPMO_CONTROL_IMAGE WHERE RECORD_ID = {0} AND CONTROL_ID = {1}", Me.RecordId, controlId)
|
||||
Dim bimg() As Byte = ClassDatabase.Execute_Scalar(sql)
|
||||
|
||||
If Not IsNothing(bimg) Then
|
||||
Dim img As Bitmap = ByteArrayToBitmap(bimg)
|
||||
If Not IsNothing(bimg) Then
|
||||
Dim img As Bitmap = ByteArrayToBitmap(bimg)
|
||||
|
||||
pb.BackgroundImage = img
|
||||
pb.BackgroundImageLayout = ImageLayout.Zoom
|
||||
End If
|
||||
Catch ex As Exception
|
||||
' Kein Bild laden
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
End Select
|
||||
pb.BackgroundImage = img
|
||||
pb.BackgroundImageLayout = ImageLayout.Zoom
|
||||
End If
|
||||
Catch ex As Exception
|
||||
' Kein Bild laden
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Class ControlProps
|
||||
|
||||
' Base Props
|
||||
Public Id As Integer
|
||||
Public Name As String
|
||||
@@ -388,88 +423,118 @@ Public Class ClassRecordView
|
||||
#Region "Control Builder Simple"
|
||||
|
||||
Private Function LoadLabel(props As ControlProps) As Label
|
||||
Dim label As Label = SetBaseProps(New Label, props)
|
||||
Try
|
||||
Dim label As Label = SetBaseProps(New Label, props)
|
||||
|
||||
label.Text = props.Caption
|
||||
label.Font = props.Font
|
||||
label.ForeColor = props.FontColor
|
||||
'label.BackColor = props.BackColor
|
||||
label.BackColor = Color.White
|
||||
label.AutoSize = True
|
||||
label.Text = props.Caption
|
||||
label.Font = props.Font
|
||||
label.ForeColor = props.FontColor
|
||||
'label.BackColor = props.BackColor
|
||||
label.BackColor = Color.White
|
||||
label.AutoSize = True
|
||||
|
||||
props = LoadDataSource(props)
|
||||
props = LoadDataSource(props)
|
||||
|
||||
If (Not IsNothing(props.DataSource)) Then
|
||||
If props.DataSource.GetType() Is GetType(DataTable) Then
|
||||
Dim row0 As DataRow = DirectCast(props.DataSource, DataTable).Rows(0)
|
||||
Dim value = row0.Item(0)
|
||||
label.Text = value
|
||||
Else
|
||||
label.Text = props.DataSource.ToString()
|
||||
End If
|
||||
|
||||
If (Not IsNothing(props.DataSource)) Then
|
||||
If props.DataSource.GetType() Is GetType(DataTable) Then
|
||||
Dim row0 As DataRow = DirectCast(props.DataSource, DataTable).Rows(0)
|
||||
Dim value = row0.Item(0)
|
||||
label.Text = value
|
||||
Else
|
||||
label.Text = props.DataSource.ToString()
|
||||
End If
|
||||
|
||||
End If
|
||||
Return label
|
||||
Catch ex As Exception
|
||||
|
||||
Return label
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Private Function LoadTextBox(props As ControlProps) As TextBox
|
||||
Dim textbox As TextBox = SetBaseProps(New TextBox, props)
|
||||
Try
|
||||
Dim textbox As TextBox = SetBaseProps(New TextBox, props)
|
||||
|
||||
textbox.BorderStyle = BorderStyle.FixedSingle
|
||||
textbox.Font = props.Font
|
||||
textbox.ForeColor = props.FontColor
|
||||
'textbox.BackColor = props.BackColor
|
||||
textbox.BackColor = Color.White
|
||||
textbox.ReadOnly = True
|
||||
textbox.BorderStyle = BorderStyle.FixedSingle
|
||||
textbox.Font = props.Font
|
||||
textbox.ForeColor = props.FontColor
|
||||
'textbox.BackColor = props.BackColor
|
||||
textbox.BackColor = Color.White
|
||||
textbox.ReadOnly = True
|
||||
|
||||
Return textbox
|
||||
Return textbox
|
||||
Catch ex As Exception
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
' Die Combobox wird als Textbox dargestellt
|
||||
Private Function LoadCombobox(props As ControlProps) As TextBox
|
||||
Dim combo As TextBox = SetBaseProps(New TextBox, props)
|
||||
Try
|
||||
Dim combo As TextBox = SetBaseProps(New TextBox, props)
|
||||
|
||||
combo.BorderStyle = BorderStyle.FixedSingle
|
||||
combo.Font = props.Font
|
||||
combo.ForeColor = props.FontColor
|
||||
'combo.BackColor = props.BackColor
|
||||
combo.BackColor = Color.White
|
||||
combo.ReadOnly = True
|
||||
combo.BorderStyle = BorderStyle.FixedSingle
|
||||
combo.Font = props.Font
|
||||
combo.ForeColor = props.FontColor
|
||||
'combo.BackColor = props.BackColor
|
||||
combo.BackColor = Color.White
|
||||
combo.ReadOnly = True
|
||||
|
||||
Return combo
|
||||
Return combo
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
' Der Datepicker wird als Textbox dargestellt
|
||||
Private Function LoadDatePicker(props As ControlProps) As TextBox
|
||||
Dim dtp As TextBox = SetBaseProps(New TextBox, props)
|
||||
Try
|
||||
Dim dtp As TextBox = SetBaseProps(New TextBox, props)
|
||||
|
||||
dtp.BorderStyle = BorderStyle.FixedSingle
|
||||
dtp.Font = props.Font
|
||||
dtp.ForeColor = props.FontColor
|
||||
'dtp.BackColor = props.BackColor
|
||||
dtp.BackColor = Color.White
|
||||
dtp.ReadOnly = True
|
||||
dtp.BorderStyle = BorderStyle.FixedSingle
|
||||
dtp.Font = props.Font
|
||||
dtp.ForeColor = props.FontColor
|
||||
'dtp.BackColor = props.BackColor
|
||||
dtp.BackColor = Color.White
|
||||
dtp.ReadOnly = True
|
||||
|
||||
Return dtp
|
||||
Return dtp
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Private Function LoadCheckBox(props As ControlProps) As CheckBox
|
||||
Dim check As CheckBox = SetBaseProps(New CheckBox, props)
|
||||
Try
|
||||
Dim check As CheckBox = SetBaseProps(New CheckBox, props)
|
||||
|
||||
check.Text = props.Caption
|
||||
check.AutoCheck = False
|
||||
check.Text = props.Caption
|
||||
check.AutoCheck = False
|
||||
|
||||
Return check
|
||||
Return check
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Private Function LoadRadioButton(props As ControlProps) As RadioButton
|
||||
Dim radio As RadioButton = SetBaseProps(New RadioButton, props)
|
||||
Try
|
||||
Dim radio As RadioButton = SetBaseProps(New RadioButton, props)
|
||||
|
||||
radio.Text = props.Caption
|
||||
radio.AutoCheck = False
|
||||
radio.Text = props.Caption
|
||||
radio.AutoCheck = False
|
||||
|
||||
Return radio
|
||||
Return radio
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Private Function LoadListBox(props As ControlProps) As ListBoxControl
|
||||
@@ -485,32 +550,37 @@ Public Class ClassRecordView
|
||||
End Function
|
||||
|
||||
Private Function LoadCheckedListBox(props As ControlProps) As CheckedListBoxControl
|
||||
Dim checklistbox As CheckedListBoxControl = SetBaseProps(New CheckedListBoxControl, props)
|
||||
Try
|
||||
Dim checklistbox As CheckedListBoxControl = SetBaseProps(New CheckedListBoxControl, props)
|
||||
|
||||
props = LoadDataSource(props)
|
||||
|
||||
If Not IsNothing(props.StaticList) Then
|
||||
checklistbox.DataSource = props.StaticList
|
||||
End If
|
||||
|
||||
If Not IsNothing(props.DataSource) Then
|
||||
If props.DataSource.GetType() Is GetType(DataTable) Then
|
||||
Dim dt As DataTable = props.DataSource
|
||||
|
||||
If dt.Columns.Count = 1 Then
|
||||
checklistbox.DisplayMember = dt.Columns(0).ColumnName
|
||||
checklistbox.ValueMember = dt.Columns(0).ColumnName
|
||||
ElseIf dt.Columns.Count = 2 Then
|
||||
checklistbox.DisplayMember = dt.Columns(1).ColumnName
|
||||
checklistbox.ValueMember = dt.Columns(0).ColumnName
|
||||
End If
|
||||
props = LoadDataSource(props)
|
||||
|
||||
If Not IsNothing(props.StaticList) Then
|
||||
checklistbox.DataSource = props.StaticList
|
||||
End If
|
||||
|
||||
checklistbox.DataSource = props.DataSource
|
||||
End If
|
||||
If Not IsNothing(props.DataSource) Then
|
||||
If props.DataSource.GetType() Is GetType(DataTable) Then
|
||||
Dim dt As DataTable = props.DataSource
|
||||
|
||||
Return checklistbox
|
||||
If dt.Columns.Count = 1 Then
|
||||
checklistbox.DisplayMember = dt.Columns(0).ColumnName
|
||||
checklistbox.ValueMember = dt.Columns(0).ColumnName
|
||||
ElseIf dt.Columns.Count = 2 Then
|
||||
checklistbox.DisplayMember = dt.Columns(1).ColumnName
|
||||
checklistbox.ValueMember = dt.Columns(0).ColumnName
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
checklistbox.DataSource = props.DataSource
|
||||
End If
|
||||
|
||||
Return checklistbox
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Private Function LoadPictureBox(props As ControlProps) As PictureBox
|
||||
|
||||
Reference in New Issue
Block a user