This commit is contained in:
SchreiberM 2016-04-19 11:10:28 +02:00
commit add1a19324
10 changed files with 378 additions and 315 deletions

View File

@ -82,6 +82,40 @@ Public Class ClassControlBuilder
End If
End Sub
Private Sub OnEnabledChanged(sender As Object, e As EventArgs)
Dim control As Control = DirectCast(sender, Control)
' Checkbox, radiobutton, label ist sonderfall
If control.GetType() = GetType(CheckBox) Or _
control.GetType() = GetType(RadioButton) Or _
control.GetType() = GetType(Label) Then
' Hier wird nur die vordergrund-farbe geändert
control.ForeColor = Color.Black
Exit Sub
End If
If control.Enabled Then
control.BackColor = Color.White
control.ForeColor = Color.Black
ElseIf control.Enabled = False Then
control.BackColor = System.Drawing.SystemColors.Info
control.ForeColor = Color.Black 'System.Drawing.SystemColors.InfoText
End If
End Sub
' Wie OnEnabledChanged, nur für TextBVi
Private Sub OnReadOnlyChanged(sender As Object, e As EventArgs)
Dim control As TextBox = DirectCast(sender, TextBox)
If control.ReadOnly = False Then
control.BackColor = Color.White
control.ForeColor = Color.Black
ElseIf control.ReadOnly = True Then
control.BackColor = System.Drawing.SystemColors.Info
control.ForeColor = Color.Black 'System.Drawing.SystemColors.InfoText
End If
End Sub
Public Sub OnTextBoxFocus(sender As Object, ByVal e As EventArgs)
Dim box As TextBox = sender
box.BackColor = Color.LemonChiffon
@ -96,11 +130,11 @@ Public Class ClassControlBuilder
End Sub
Public Sub OnComboBoxFocus(sender As Object, ByVal e As EventArgs)
Dim combo As ComboBox = sender
Dim combo As CustomComboBox = sender
combo.BackColor = Color.LemonChiffon
End Sub
Public Sub OnComboBoxLostFocus(sender As Object, ByVal e As EventArgs)
Dim combo As ComboBox = sender
Dim combo As CustomComboBox = sender
combo.BackColor = Color.White
End Sub
Dim CONTROL_ID
@ -115,11 +149,11 @@ Public Class ClassControlBuilder
Dim value
Select Case control.GetType()
Case GetType(ComboBox)
If IsNothing(DirectCast(control, ComboBox).ValueMember) Then
value = DirectCast(control, ComboBox).Text
Case GetType(CustomComboBox)
If IsNothing(DirectCast(control, CustomComboBox).ValueMember) Then
value = DirectCast(control, CustomComboBox).Text
Else
value = DirectCast(control, ComboBox).SelectedValue
value = DirectCast(control, CustomComboBox).SelectedValue
End If
Case Else
Exit Sub
@ -159,11 +193,11 @@ Public Class ClassControlBuilder
Dim dt As DataTable = ClassDatabase.Return_Datatable(sqlcommand)
Dim obj
obj = dependingControl.GetType.ToString
Select Case dependingControl.GetType.ToString
Select Case dependingControl.GetType().Name
Case "System.Windows.Forms.ComboBox"
ControlLoader.Combobox.SetDataSource(DirectCast(dependingControl, ComboBox), dt)
Case "System.Windows.Forms.Label"
Case "ComboBox"
ControlLoader.Combobox.SetDataSource(DirectCast(dependingControl, CustomComboBox), dt)
Case "Label"
If dt.Rows.Count = 1 Then
Try
ControlLoader.Label.LoadValue(DirectCast(dependingControl, Label), 9999, 9999, dt.Rows(0).Item(0).ToString, True)
@ -171,7 +205,7 @@ Public Class ClassControlBuilder
ClassLogger.Add(ex.Message)
End Try
End If
Case "System.Windows.Forms.TextBox"
Case "TextBox"
If dt.Rows.Count = 1 Then
Try
Dim value1 As String = dt.Rows(0).Item(0)
@ -228,7 +262,7 @@ Public Class ClassControlBuilder
' Dim dependingControlId As Integer = datatable.Rows(0).Item("GUID")
' Dim panel As Panel = DirectCast(control.Parent, Panel)
' ' Über die Id das Control finden
' Dim dependingControl As ComboBox = panel.Controls.OfType(Of ComboBox)().Where(Function(c As ComboBox)
' Dim dependingControl As CustomComboBox = panel.Controls.OfType(Of CustomComboBox)().Where(Function(c As CustomComboBox)
' Return DirectCast(c.Tag, ClassControlMetadata).Id = dependingControlId
' End Function).SingleOrDefault()
@ -267,43 +301,64 @@ Public Class ClassControlBuilder
AddHandler control.MouseHover, AddressOf MouseHover
Select Case type
Case "Label"
Dim label As Label = CType(control, Label)
AddHandler label.EnabledChanged, AddressOf OnEnabledChanged
Case "TextBox"
Dim textbox As TextBox = CType(control, TextBox)
AddHandler textbox.TextChanged, AddressOf RecordChanged
AddHandler textbox.GotFocus, AddressOf OnTextBoxFocus
AddHandler textbox.LostFocus, AddressOf OnTextBoxLostFocus
AddHandler textbox.TextChanged, AddressOf OnTextBoxTextChanged
AddHandler textbox.ReadOnlyChanged, AddressOf OnReadOnlyChanged
Case "ComboBox"
Dim combo As ComboBox = CType(control, ComboBox)
Dim combo As CustomComboBox = CType(control, CustomComboBox)
AddHandler combo.SelectedValueChanged, AddressOf RecordChanged
AddHandler combo.SelectedValueChanged, AddressOf OnComboBoxValueChanged
AddHandler combo.TextChanged, AddressOf RecordChanged
AddHandler combo.GotFocus, AddressOf OnComboBoxFocus
AddHandler combo.LostFocus, AddressOf OnComboBoxLostFocus
'AddHandler combo.GotFocus, AddressOf OnComboBoxFocus
'AddHandler combo.LostFocus, AddressOf OnComboBoxLostFocus
AddHandler combo.EnabledChanged, AddressOf OnEnabledChanged
Case "RadioButton"
Dim radiobutton As RadioButton = CType(control, RadioButton)
AddHandler radiobutton.CheckedChanged, AddressOf RecordChanged
AddHandler radiobutton.EnabledChanged, AddressOf OnEnabledChanged
Case "CheckBox"
Dim checkbox As CheckBox = CType(control, CheckBox)
AddHandler checkbox.CheckedChanged, AddressOf RecordChanged
AddHandler checkbox.EnabledChanged, AddressOf OnEnabledChanged
Case "PictureBox"
Dim picturebox As PictureBox = CType(control, PictureBox)
AddHandler picturebox.BackgroundImageChanged, AddressOf RecordChanged
AddHandler picturebox.EnabledChanged, AddressOf OnEnabledChanged
Case "DateEdit"
Dim datetimepick As DevExpress.XtraEditors.DateEdit = CType(control, DevExpress.XtraEditors.DateEdit)
AddHandler datetimepick.DateTimeChanged, AddressOf RecordChanged
AddHandler datetimepick.EnabledChanged, AddressOf OnEnabledChanged
Case "ListBoxControl"
Dim listbox As DevExpress.XtraEditors.ListBoxControl = CType(control, DevExpress.XtraEditors.ListBoxControl)
AddHandler listbox.SelectedValueChanged, AddressOf RecordChanged
AddHandler listbox.EnabledChanged, AddressOf OnEnabledChanged
Case "CheckedListBoxControl"
Dim chklistbox As DevExpress.XtraEditors.CheckedListBoxControl = CType(control, DevExpress.XtraEditors.CheckedListBoxControl)
AddHandler chklistbox.ItemCheck, AddressOf RecordChanged
AddHandler chklistbox.EnabledChanged, AddressOf OnEnabledChanged
Case "DataGridView"
Dim gridview As DataGridView = CType(control, DataGridView)
AddHandler gridview.RowsAdded, AddressOf RecordChanged
AddHandler gridview.CellValueChanged, AddressOf RecordChanged
AddHandler gridview.RowsRemoved, AddressOf RecordChanged
AddHandler gridview.EnabledChanged, AddressOf OnEnabledChanged
End Select
End Sub
@ -480,7 +535,7 @@ Public Class ClassControlBuilder
End If
End Sub
Private Sub AddComboHandler(control As ComboBox, format As String)
Private Sub AddComboHandler(control As CustomComboBox, format As String)
If format = "Currency" Then
AddHandler control.Leave, AddressOf Combo_Currency_Handler
ElseIf format = "Decimal" Then
@ -510,7 +565,7 @@ Public Class ClassControlBuilder
End Sub
Private Sub Combo_Currency_Handler(sender As Object, e As EventArgs)
Dim control As ComboBox = DirectCast(sender, ComboBox)
Dim control As CustomComboBox = DirectCast(sender, CustomComboBox)
Dim value As Decimal
If Decimal.TryParse(control.Text.Trim(), value) Then
control.Text = value.ToString("c")
@ -521,7 +576,7 @@ Public Class ClassControlBuilder
End Sub
Private Sub Combo_Decimal_Handler(sender As Object, e As EventArgs)
Dim control As ComboBox = DirectCast(sender, ComboBox)
Dim control As CustomComboBox = DirectCast(sender, CustomComboBox)
Dim value As Decimal
If Decimal.TryParse(control.Text.Trim(), value) Then
control.Text = value.ToString("###,###")
@ -544,31 +599,32 @@ Public Class ClassControlBuilder
Public Sub SetActiveColor(ActiveControl As Control)
Dim ActiveColor As Color = Color.DarkOrange
Dim CurrentType As String = ActiveControl.GetType.ToString
Dim CurrentType As String = ActiveControl.GetType().Name
Select Case CurrentType
Case "System.Windows.Forms.TextBox"
Case "TextBox"
ActiveControl.BackColor = ActiveColor
Case "System.Windows.Forms.ComboBox"
Case "ComboBox"
'Case "System.Windows.Forms.ComboBox"
ActiveControl.BackColor = ActiveColor
Case "System.Windows.Forms.Label"
Case "Label"
ActiveControl.BackColor = ActiveColor
Case "System.Windows.Forms.CheckBox"
Case "CheckBox"
ActiveControl.BackColor = ActiveColor
Case "System.Windows.Forms.Button"
Case "Button"
ActiveControl.BackColor = ActiveColor
Case "System.Windows.Forms.DataGridView"
Case "DataGridView"
Dim current As DataGridView = DirectCast(ActiveControl, DataGridView)
current.BackgroundColor = ActiveColor
Case "DevExpress.XtraEditors.DateEdit"
Case "DateEdit"
ActiveControl.BackColor = ActiveColor
Case "System.Window.Forms.GroupBox"
Case "GroupBox"
ActiveControl.BackColor = ActiveColor
Case "System.Windows.Forms.PictureBox"
Case "PictureBox"
ActiveControl.BackColor = ActiveColor
Case "DevExpress.XtraEditors.CheckedListBoxControl"
Case "CheckedListBoxControl"
ActiveControl.BackColor = ActiveColor
Case "DevExpress.XtraEditors.ListBoxControl"
Case "ListBoxControl"
ActiveControl.BackColor = ActiveColor
End Select
End Sub
@ -576,56 +632,58 @@ Public Class ClassControlBuilder
Public Sub ResetActiveColor(ActiveControl As Control)
For Each inctrl As Control In Me._master_panel.Controls
If inctrl.Name <> ActiveControl.Name Then
Dim Type As String = inctrl.GetType.ToString
Dim Type As String = inctrl.GetType().Name
Select Case Type
Case "System.Windows.Forms.TextBox"
Case "TextBox"
inctrl.BackColor = Color.White
Case "System.Windows.Forms.ComboBox"
Case "ComboBox"
'Case "System.Windows.Forms.ComboBox"
inctrl.BackColor = Color.White
Case "System.Windows.Forms.Label"
Case "Label"
inctrl.BackColor = Color.Transparent
Case "System.Windows.Forms.CheckBox"
Case "CheckBox"
inctrl.BackColor = Color.Transparent
Case "System.Windows.Forms.DataGridView"
Case "DataGridView"
Dim ctrl As DataGridView = DirectCast(inctrl, DataGridView)
ctrl.BackgroundColor = SystemColors.ControlDark
Case "DevExpress.XtraEditors.DateEdit"
Case "DateEdit"
inctrl.BackColor = Color.White
Case "System.Windows.Forms.Button"
Case "Button"
inctrl.BackColor = SystemColors.Control
Case "System.Windows.Forms.GroupBox"
Case "GroupBox"
inctrl.BackColor = SystemColors.Control
Case "DevExpress.XtraEditors.CheckedListBoxControl"
Case "CheckedListBoxControl"
inctrl.BackColor = Color.White
Case "DevExpress.XtraEditors.ListBoxControl"
Case "ListBoxControl"
inctrl.BackColor = Color.White
Case "System.Windows.Forms.PictureBox"
Case "PictureBox"
inctrl.BackColor = SystemColors.ControlDark
For Each gbctrl As Control In inctrl.Controls
If gbctrl.Name <> ActiveControl.Name Then
Dim gbType As String = gbctrl.GetType.ToString
Select Case gbType
Case "System.Windows.Forms.TextBox"
Case "TextBox"
gbctrl.BackColor = Color.White
Case "System.Windows.Forms.ComboBox"
Case "ComboBox"
'Case "System.Windows.Forms.ComboBox"
gbctrl.BackColor = Color.White
Case "System.Windows.Forms.Label"
Case "Label"
gbctrl.BackColor = Color.Transparent
Case "System.Windows.Forms.CheckBox"
Case "CheckBox"
gbctrl.BackColor = Color.Transparent
Case "System.Windows.Forms.DataGridView"
Case "DataGridView"
Dim ctrl As DataGridView = DirectCast(gbctrl, DataGridView)
ctrl.BackgroundColor = SystemColors.ControlDark
Case "DevExpress.XtraEditors.DateEdit"
Case "DateEdit"
gbctrl.BackColor = Color.White
Case "System.Windows.Forms.Button"
Case "Button"
gbctrl.BackColor = SystemColors.Control
Case "System.Windows.Forms.PictureBox"
Case "PictureBox"
inctrl.BackColor = SystemColors.ControlDark
Case "DevExpress.XtraEditors.CheckedListBoxControl"
Case "CheckedListBoxControl"
inctrl.BackColor = Color.White
Case "DevExpress.XtraEditors.ListBoxControl"
Case "ListBoxControl"
inctrl.BackColor = Color.White
End Select
End If
@ -988,7 +1046,9 @@ Public Class ClassControlBuilder
Optional parent As GroupBox = Nothing,
Optional _designMode As Boolean = False)
Try
Dim control As New ComboBox
Dim _control As New ComboBox
Dim control As New CustomComboBox
Dim defaultSize As Size = New Size(120, 24)
Dim metadata As New ClassControlMetadata()
@ -1036,7 +1096,7 @@ Public Class ClassControlBuilder
End If
Me.SetEventHandlers(control)
Me.CurrentControl = DirectCast(control, ComboBox)
Me.CurrentControl = DirectCast(control, CustomComboBox)
If Not IsNothing(parent) Then
control.Parent = parent
Me.AddToGroupBox(parent, control)
@ -1049,7 +1109,7 @@ Public Class ClassControlBuilder
End Try
End Sub
Public Sub AutoCompleteCombo_KeyUp(ByVal cbo As ComboBox, ByVal e As KeyEventArgs)
Public Sub AutoCompleteCombo_KeyUp(ByVal cbo As CustomComboBox, ByVal e As KeyEventArgs)
''Allow select keys without Autocompleting
Select Case e.KeyCode
Case Keys.Back, Keys.Left, Keys.Right, Keys.Up, Keys.Delete, Keys.Down
@ -1093,7 +1153,7 @@ Public Class ClassControlBuilder
'End If
End Sub
Public Sub AutoCompleteCombo_Leave(ByVal cbo As ComboBox)
Public Sub AutoCompleteCombo_Leave(ByVal cbo As CustomComboBox)
Dim iFoundIndex As Integer
iFoundIndex = cbo.FindStringExact(cbo.Text)
cbo.SelectedIndex = iFoundIndex

View File

@ -487,14 +487,8 @@ Public Class ClassControlCommandsUI
End Sub
Private Sub UpdateAllControls(FormID As Integer, RecordID As Integer, controls As Control.ControlCollection)
Dim controlGUID
Try
For Each ctrl As Control In controls
controlGUID = DirectCast(ctrl.Tag, ClassControlMetadata).Id
If controlGUID = 993 Then
Console.WriteLine("Obacht")
End If
Dim CONTROL_ID As Integer = DirectCast(ctrl.Tag, ClassControlMetadata).Id 'GetControlID_for_RecordID(ctrl.Name, RecordID)
If LogErrorsOnly = False Then ClassLogger.Add(" >> CONTROL_ID: " & CONTROL_ID, False)
Dim CONTROL_VALUE As String = GetControlValue(ctrl)
@ -512,27 +506,15 @@ Public Class ClassControlCommandsUI
End If
If TypeOf ctrl Is DevExpress.XtraEditors.CheckedListBoxControl Then
Try
If Not IsNothing(CONTROL_VALUE) Then
Dim id As Integer = DirectCast(ctrl.Tag, ClassControlMetadata).Id
UpdateMultipleValues(id, RecordID, CONTROL_VALUE)
Continue For
End If
Catch ex As Exception
MsgBox("Unexpected Error in UpdateAllControls-CheckedListBox: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End If
If TypeOf ctrl Is Windows.Forms.DataGridView Then
Try
Dim id As Integer = DirectCast(ctrl.Tag, ClassControlMetadata).Id
UpdateMultipleValues(id, RecordID, CONTROL_VALUE)
Continue For
Catch ex As Exception
MsgBox("Unexpected Error in UpdateAllControls-DataGridView: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End If
Dim ValueExists = ClassDatabase.Execute_Scalar(String.Format("SELECT RECORD_ID FROM VWPMO_VALUES WHERE RECORD_ID = {0} AND CONTROL_ID = {1}", RecordID, CONTROL_ID))
@ -549,7 +531,7 @@ Public Class ClassControlCommandsUI
End If
Next
Catch ex As Exception
MsgBox("Unexpected Error in UpdateAllControls - Control-ID: " & controlGUID.tostring & vbNewLine & ex.Message, MsgBoxStyle.Critical)
MsgBox("Unexpected Error in UpdateAllControls: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
@ -580,7 +562,7 @@ Public Class ClassControlCommandsUI
End Sub
Function GetControlValue(ctrl As Control) As String
Try
Dim type = ctrl.GetType().Name
Dim CONTROL_ID As Integer = DirectCast(ctrl.Tag, ClassControlMetadata).Id ' GetControlID_for_RecordID(ctrl.Name, CURRENT_RECORD_ID)
If LogErrorsOnly = False Then ClassLogger.Add(" >> GetControlValue CONTROL_ID: " & CONTROL_ID, False)
@ -590,8 +572,8 @@ Public Class ClassControlCommandsUI
Case "TextBox"
Return DirectCast(ctrl, TextBox).Text
Case "ComboBox"
If LogErrorsOnly = False Then ClassLogger.Add(" >> Return Value: " & DirectCast(ctrl, ComboBox).Text, False)
Return DirectCast(ctrl, ComboBox).Text
If LogErrorsOnly = False Then ClassLogger.Add(" >> Return Value: " & DirectCast(ctrl, CustomComboBox).Text, False)
Return DirectCast(ctrl, CustomComboBox).Text
Case "CheckBox"
Return DirectCast(ctrl, CheckBox).Checked.ToString()
Case "RadioButton"
@ -625,15 +607,7 @@ Public Class ClassControlCommandsUI
' Überspringt den Rest der funktion
Return result_string
End If
Dim countSelectedItems As Integer = 0
For Each item As Object In DirectCast(ctrl, DevExpress.XtraEditors.CheckedListBoxControl).CheckedItems
countSelectedItems += 1
Next
Dim sqlControl = ClassDatabase.Execute_Scalar("SELECT SQL_COMMAND_1 FROM TBPMO_CONTROL WHERE GUID = " & CONTROL_ID)
sqlControl = sqlControl.ToString.ToUpper
Dim checked_result_string As String
If sqlControl.contains("SELECT [RECORD-ID],") Then
'Alle Recorddatensätze durchlaufen und überprüfen ob nicht angehakt
'Wenn nicht angehakt dann Record löschen
Dim index As Integer = 0
@ -641,7 +615,6 @@ Public Class ClassControlCommandsUI
Dim item = chklbx.GetItem(i)
Dim row As DataRowView = CType(item, DataRowView)
If chklbx.GetItemCheckState(i) = 0 Then
Try
If CInt(row(0)) > 0 Then
'Überprüfen ob es den Record gibt
Dim SQL = "SELECT COUNT(*) FROM TBPMO_RECORD_CONNECT WHERE RECORD1_ID = " & CURRENT_RECORD_ID & " AND RECORD2_ID = " & CInt(row(0))
@ -652,17 +625,12 @@ Public Class ClassControlCommandsUI
End If
End If
End If
Catch ex As Exception
ClassLogger.Add(" >> ERROR CHECKEDLISTBOX NoINTEGER-COLUMN: " & ex.Message)
Return Nothing
End Try
End If
Next
'Für jeden gecheckten Eintrag den Record der Stammentität mit dem selektierten linken
Dim checked_result As New List(Of String)
Dim checked_result_string As String
For Each item As Object In DirectCast(ctrl, DevExpress.XtraEditors.CheckedListBoxControl).CheckedItems
Dim row As DataRowView = CType(item, DataRowView)
@ -689,26 +657,12 @@ Public Class ClassControlCommandsUI
End Try
Next
Else 'Einfach nur eine Datensauswahl mit Strings!
If countSelectedItems > 0 Then
Dim checked_result As New List(Of String)
For Each item As Object In DirectCast(ctrl, DevExpress.XtraEditors.CheckedListBoxControl).CheckedItems
Dim row As DataRowView = CType(item, DataRowView)
Dim checked_value = row(1)
checked_result.Add(checked_value)
checked_result_string = String.Join(";", checked_result)
Next
Else
checked_result_string = ""
End If
End If
' Hier wird ein String zurückgegeben, der als VALUE gespeichert werden soll
' Überspringt den Rest der funktion
If Not IsNothing(checked_result_string) Then
Dim sql = String.Format("select count(*) from TBPMO_CONTROL_VALUE where CONTROL_ID = {0} and RECORD_ID = {1}", CONTROL_ID, CURRENT_RECORD_ID)
If ClassDatabase.Execute_Scalar(sql) = 0 Then
InsertControlValue(CONTROL_ID, CURRENT_RECORD_ID, checked_result_string)
InsertControlValue(CONTROL_ID, CURRENT_RECORD_ID, "")
End If
Return checked_result_string
Else
@ -737,12 +691,6 @@ Public Class ClassControlCommandsUI
Case Else
Return Nothing
End Select
Catch ex As Exception
ClassLogger.Add("Unexpected Error in GetControlValue: " & ex.Message)
MsgBox("Unexpected Error in GetControlValue: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
Return Nothing
End Try
End Function
Public Shared Function InsertControlValue(ControlID As Integer, RecordID As Integer, Value As String)

View File

@ -107,7 +107,7 @@
End Try
End Function
Overloads Shared Sub SetDataSource(control As Windows.Forms.ComboBox, dt As DataTable)
Overloads Shared Sub SetDataSource(control As CustomComboBox, dt As DataTable)
Dim sw As Stopwatch = Stopwatch.StartNew()
Dim columnCount As Integer = dt.Columns.Count
@ -296,11 +296,11 @@
Public Class Combobox : Inherits _ListControl
Public Shared Sub LoadValue(control As Windows.Forms.ComboBox, recordId As Integer, parentRecordId As Integer, value As String)
Public Shared Sub LoadValue(control As CustomComboBox, recordId As Integer, parentRecordId As Integer, value As String)
control.Text = value
End Sub
Public Shared Sub LoadList(control As Windows.Forms.ComboBox, formId As Integer, connID As Object, SQLCommand As String)
Public Shared Sub LoadList(control As CustomComboBox, formId As Integer, connID As Object, SQLCommand As String)
Try
Dim dynamic As DynamicValue = GetDynamicValue(DirectCast(control.Tag, ClassControlMetadata).Id, formId, connID, SQLCommand)
@ -317,7 +317,7 @@
End Try
End Sub
Private Shared Sub CalculateDropdownWidth(control As Windows.Forms.ComboBox, dt As DataTable)
Private Shared Sub CalculateDropdownWidth(control As CustomComboBox, dt As DataTable)
Try
Const WIDEST_WIDTH As Integer = 300
Dim FinalWidth As Integer = WIDEST_WIDTH

View File

@ -13,8 +13,8 @@ Public Class ClassControlValues
Return True
End If
Case GetType(ComboBox)
Dim combobox As ComboBox = DirectCast(control, ComboBox)
Case GetType(CustomComboBox)
Dim combobox As CustomComboBox = DirectCast(control, CustomComboBox)
If combobox.Text.Trim() = String.Empty Then
Return False
Else
@ -236,8 +236,8 @@ Public Class ClassControlValues
Dim label As Label = DirectCast(control, Label)
ControlLoader.Label.LoadValue(label, recordId, parentRecordId, value, entity_ID)
Case GetType(ComboBox)
Dim combobox As ComboBox = DirectCast(control, ComboBox)
Case GetType(CustomComboBox)
Dim combobox As CustomComboBox = DirectCast(control, CustomComboBox)
ControlLoader.Combobox.LoadValue(combobox, recordId, parentRecordId, value)
Case GetType(CheckBox)
@ -317,8 +317,8 @@ Public Class ClassControlValues
Dim sqlcommand As String = row.Item("SQL")
Dim ConnID = row.Item("CONTROL_CONNID_1")
Select Case Ctrl.GetType()
Case GetType(ComboBox)
Dim combobox = DirectCast(Ctrl, ComboBox)
Case GetType(CustomComboBox)
Dim combobox = DirectCast(Ctrl, CustomComboBox)
ControlLoader.Combobox.LoadList(combobox, FormID, ConnID, sqlcommand)
Case GetType(DevExpress.XtraEditors.ListBoxControl)
@ -377,8 +377,8 @@ Public Class ClassControlValues
sqlcommand = ReplaceSqlCommandPlaceholders(sqlcommand, RecordId, ParentRecordId, entity_ID)
Select Case Ctrl.GetType()
Case GetType(ComboBox)
Dim combobox = DirectCast(Ctrl, ComboBox)
Case GetType(CustomComboBox)
Dim combobox = DirectCast(Ctrl, CustomComboBox)
ControlLoader.Combobox.LoadList(combobox, FormId, connID, sqlcommand)
Case GetType(DevExpress.XtraEditors.ListBoxControl)
@ -412,8 +412,8 @@ Public Class ClassControlValues
Public Shared Sub UnloadControlValuesList(RecordID As Integer, FormID As Integer, controls As Control.ControlCollection)
For Each C As Control In controls
If TypeOf C Is ComboBox Then
Dim Combobox = DirectCast(C, ComboBox)
If TypeOf C Is CustomComboBox Then
Dim Combobox = DirectCast(C, CustomComboBox)
Dim currentValue As String = Combobox.Text
Combobox.DataSource = Nothing
Combobox.Text = currentValue
@ -451,8 +451,8 @@ Public Class ClassControlValues
Case GetType(TextBox)
DirectCast(control, TextBox).Text = String.Empty
Case GetType(ComboBox)
Dim combo As ComboBox = DirectCast(control, ComboBox)
Case GetType(CustomComboBox)
Dim combo As CustomComboBox = DirectCast(control, CustomComboBox)
combo.SelectedIndex = -1
combo.Text = String.Empty
@ -550,8 +550,8 @@ Public Class ClassControlValues
Dim radio As RadioButton = DirectCast(control, RadioButton)
radio.Checked = StrToBool(autoValue)
Case GetType(ComboBox)
Dim combobox As ComboBox = DirectCast(control, ComboBox)
Case GetType(CustomComboBox)
Dim combobox As CustomComboBox = DirectCast(control, CustomComboBox)
If IsDBNull(autoValue) Then
combobox.SelectedIndex = -1
Else

View File

@ -0,0 +1,51 @@
Public Class CustomComboBox
Inherits Windows.Forms.ComboBox
Public Sub New()
MyBase.New()
DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
End Sub
Protected Overrides Sub OnEnabledChanged(e As EventArgs)
'MyBase.OnEnabledChanged(e)
If Me.Enabled Then
Me.DropDownStyle = ComboBoxStyle.DropDown
Else
Me.DropDownStyle = ComboBoxStyle.DropDownList
End If
End Sub
Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
Dim g As System.Drawing.Graphics = e.Graphics
Dim rect As Rectangle = e.Bounds
If e.Index >= 0 Then
Dim label As String = Me.Items(e.Index).ToString()
If e.State = (DrawItemState.Disabled Or DrawItemState.NoAccelerator Or DrawItemState.NoFocusRect Or DrawItemState.ComboBoxEdit) Then
' DISABLED STATE
g.FillRectangle(New SolidBrush(System.Drawing.SystemColors.Info), rect)
g.DrawString(label, e.Font, Brushes.Black, rect)
e.DrawFocusRectangle()
ElseIf (e.State = (DrawItemState.NoAccelerator Or DrawItemState.NoFocusRect)) Then
' ITEMS NOT IN FOCUS
g.FillRectangle(New SolidBrush(Color.White), rect)
g.DrawString(label, e.Font, Brushes.Black, rect)
e.DrawFocusRectangle()
Else
' ITEMS IN FOCUS
g.FillRectangle(New SolidBrush(System.Drawing.SystemColors.Highlight), rect)
g.DrawString(label, e.Font, Brushes.White, rect)
e.DrawFocusRectangle()
End If
End If
g.Dispose()
End Sub
End Class

View File

@ -245,6 +245,9 @@
<Compile Include="ClassControlMetadata.vb" />
<Compile Include="ClassControlValueCache.vb" />
<Compile Include="ClassConverter.vb" />
<Compile Include="ClassCustomComboBox.vb">
<SubType>Component</SubType>
</Compile>
<Compile Include="ClassFolderWatcher.vb" />
<Compile Include="ClassJumpRecord.vb" />
<Compile Include="ClassLicence.vb" />

View File

@ -1,10 +1,11 @@
DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraNavBar.NavBarControl, DevExpress.XtraNavBar.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraPdfViewer.PdfViewer, DevExpress.XtraPdfViewer.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.DateEdit, DevExpress.XtraEditors.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraVerticalGrid.VGridControl, DevExpress.XtraVerticalGrid.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraBars.Docking.DockManager, DevExpress.XtraBars.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraBars.Navigation.TileNavPane, DevExpress.XtraBars.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraVerticalGrid.VGridControl, DevExpress.XtraVerticalGrid.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.LookUpEdit, DevExpress.XtraEditors.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraNavBar.NavBarControl, DevExpress.XtraNavBar.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraPdfViewer.PdfViewer, DevExpress.XtraPdfViewer.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraBars.Docking.DockManager, DevExpress.XtraBars.v15.1, Version=15.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

View File

@ -22,7 +22,6 @@ Partial Class frmConstructor_Main
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmConstructor_Main))
Dim GridLevelNode1 As DevExpress.XtraGrid.GridLevelNode = New DevExpress.XtraGrid.GridLevelNode()
Dim GridLevelNode2 As DevExpress.XtraGrid.GridLevelNode = New DevExpress.XtraGrid.GridLevelNode()
@ -30,12 +29,12 @@ Partial Class frmConstructor_Main
Me.SplitContainerMain = New DevExpress.XtraEditors.SplitContainerControl()
Me.SplitContainerTop = New DevExpress.XtraEditors.SplitContainerControl()
Me.TreeViewMain = New System.Windows.Forms.TreeView()
Me.CMSEntity = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.CMSEntity = New System.Windows.Forms.ContextMenuStrip()
Me.ResetEbenenAuswahlToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.DateiimportEntitätToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.FormDesignerToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.GridControlMain = New DevExpress.XtraGrid.GridControl()
Me.ContextMenuGrid = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.ContextMenuGrid = New System.Windows.Forms.ContextMenuStrip()
Me.FunktionenDataGridToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator()
Me.AnsichtUmschaltenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
@ -82,7 +81,7 @@ Partial Class frmConstructor_Main
Me.Panel1 = New System.Windows.Forms.Panel()
Me.GridControlPos = New DevExpress.XtraGrid.GridControl()
Me.grvwGridPos = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.BindingNavigatorPOS = New System.Windows.Forms.BindingNavigator(Me.components)
Me.BindingNavigatorPOS = New System.Windows.Forms.BindingNavigator()
Me.BindingNavigatorAddNewItem = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorCountItem = New System.Windows.Forms.ToolStripLabel()
Me.BindingNavigatorDeleteItem = New System.Windows.Forms.ToolStripButton()
@ -124,20 +123,20 @@ Partial Class frmConstructor_Main
Me.tsslblStatus = New System.Windows.Forms.ToolStripStatusLabel()
Me.tsslblRecord = New System.Windows.Forms.ToolStripStatusLabel()
Me.tsslblWorkflowstate = New System.Windows.Forms.ToolStripStatusLabel()
Me.BindingSource_Entity = New System.Windows.Forms.BindingSource(Me.components)
Me.BindingSource_Entity = New System.Windows.Forms.BindingSource()
Me.DD_ECMAdmin = New DD_Record_Organiser.DD_ECMAdmin()
Me.ImageCollection1 = New DevExpress.Utils.ImageCollection(Me.components)
Me.ttToolTip = New System.Windows.Forms.ToolTip(Me.components)
Me.ContextMenuDetails = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.ImageCollection1 = New DevExpress.Utils.ImageCollection()
Me.ttToolTip = New System.Windows.Forms.ToolTip()
Me.ContextMenuDetails = New System.Windows.Forms.ContextMenuStrip()
Me.DD_DMSDataSet = New DD_Record_Organiser.DD_DMSDataSet()
Me.VWPMO_WF_USER_ACTIVEBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.VWPMO_WF_USER_ACTIVEBindingSource = New System.Windows.Forms.BindingSource()
Me.VWPMO_WF_USER_ACTIVETableAdapter = New DD_Record_Organiser.DD_DMSDataSetTableAdapters.VWPMO_WF_ACTIVETableAdapter()
Me.TableAdapterManager = New DD_Record_Organiser.DD_DMSDataSetTableAdapters.TableAdapterManager()
Me.TBPMO_FILES_USERTableAdapter = New DD_Record_Organiser.DD_DMSDataSetTableAdapters.TBPMO_FILES_USERTableAdapter()
Me.VWPMO_WF_ACTIVEBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.VWPMO_WF_ACTIVEBindingSource = New System.Windows.Forms.BindingSource()
Me.VWPMO_WF_ACTIVETableAdapter = New DD_Record_Organiser.DD_DMSDataSetTableAdapters.VWPMO_WF_ACTIVETableAdapter()
Me.TBPMO_FILES_USERBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.ToolTipController = New DevExpress.Utils.ToolTipController(Me.components)
Me.TBPMO_FILES_USERBindingSource = New System.Windows.Forms.BindingSource()
Me.ToolTipController = New DevExpress.Utils.ToolTipController()
CType(Me.SplitContainerMain, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainerMain.SuspendLayout()
CType(Me.SplitContainerTop, System.ComponentModel.ISupportInitialize).BeginInit()

View File

@ -1984,66 +1984,67 @@ Public Class frmConstructor_Main
Select Case Control.GetType()
Case GetType(Windows.Forms.GroupBox)
Lock_Record_Controls_Recursive(state, DirectCast(Control, GroupBox).Controls)
Case GetType(Windows.Forms.TextBox)
Dim txt As TextBox = CType(Control, TextBox)
txt.ReadOnly = state
Case Else
Control.Enabled = Not state
Case GetType(Windows.Forms.CheckBox)
Dim chk As CheckBox = CType(Control, CheckBox)
If state = True Then
chk.Enabled = False
Else
chk.Enabled = True
End If
'Case GetType(Windows.Forms.CheckBox)
' Dim chk As CheckBox = CType(Control, CheckBox)
' If state = True Then
' chk.Enabled = False
' Else
' chk.Enabled = True
' End If
Case GetType(Windows.Forms.RadioButton)
Dim rb As RadioButton = CType(Control, RadioButton)
If state = True Then
rb.Enabled = False
Else
rb.Enabled = True
End If
'Case GetType(Windows.Forms.RadioButton)
' Dim rb As RadioButton = CType(Control, RadioButton)
' If state = True Then
' rb.Enabled = False
' Else
' rb.Enabled = True
' End If
Case GetType(Windows.Forms.ComboBox)
Dim cbobx As System.Windows.Forms.ComboBox = CType(Control, System.Windows.Forms.ComboBox)
If state = True Then
cbobx.Enabled = False
Else
cbobx.Enabled = True
End If
'Case GetType(CustomComboBox)
' Dim cbobx As CustomComboBox = CType(Control, CustomComboBox)
' If state = True Then
' cbobx.Enabled = False
' Else
' cbobx.Enabled = True
' End If
Case GetType(DevExpress.XtraEditors.DateEdit)
Dim dtp As DevExpress.XtraEditors.DateEdit = CType(Control, DevExpress.XtraEditors.DateEdit)
If state = True Then
dtp.Enabled = False
Else
dtp.Enabled = True
End If
'Case GetType(DevExpress.XtraEditors.DateEdit)
' Dim dtp As DevExpress.XtraEditors.DateEdit = CType(Control, DevExpress.XtraEditors.DateEdit)
' If state = True Then
' dtp.Enabled = False
' Else
' dtp.Enabled = True
' End If
Case GetType(DevExpress.XtraEditors.CheckedListBoxControl)
Dim chlb As DevExpress.XtraEditors.CheckedListBoxControl = CType(Control, DevExpress.XtraEditors.CheckedListBoxControl)
If state = True Then
chlb.Enabled = False
Else
chlb.Enabled = True
End If
'Case GetType(DevExpress.XtraEditors.CheckedListBoxControl)
' Dim chlb As DevExpress.XtraEditors.CheckedListBoxControl = CType(Control, DevExpress.XtraEditors.CheckedListBoxControl)
' If state = True Then
' chlb.Enabled = False
' Else
' chlb.Enabled = True
' End If
Case GetType(DevExpress.XtraEditors.ListBoxControl)
Dim lb As DevExpress.XtraEditors.ListBoxControl = CType(Control, DevExpress.XtraEditors.ListBoxControl)
If state = True Then
lb.Enabled = False
Else
lb.Enabled = True
End If
'Case GetType(DevExpress.XtraEditors.ListBoxControl)
' Dim lb As DevExpress.XtraEditors.ListBoxControl = CType(Control, DevExpress.XtraEditors.ListBoxControl)
' If state = True Then
' lb.Enabled = False
' Else
' lb.Enabled = True
' End If
Case GetType(Windows.Forms.Button)
Dim btn As Button = CType(Control, Button)
If state = True Then
btn.Enabled = False
Else
btn.Enabled = True
End If
'Case GetType(Windows.Forms.Button)
' Dim btn As Button = CType(Control, Button)
' If state = True Then
' btn.Enabled = False
' Else
' btn.Enabled = True
' End If
End Select
Next
End Sub

View File

@ -197,7 +197,7 @@ Public Class frmSQLEditor
EnableTables()
End Sub
Private Sub GetColumns(tableName As String, ByRef combobox As ComboBox)
Private Sub GetColumns(tableName As String, ByRef combobox As CustomComboBox)
Try
Dim CS As String
CS = ClassDatabase.GetConnectionString(cmbConnection.SelectedValue)