From fd2dc4bf99ef573ccf3f823ef325bbc2d04769ae Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 4 Apr 2018 13:26:06 +0200 Subject: [PATCH] jj: add line control --- .../ClassControlBuilder.vb | 41 +++++++++++++++++-- .../ClassControlCommands.vb | 11 ++++- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/app/DD-Record-Organizer/ClassControlBuilder.vb b/app/DD-Record-Organizer/ClassControlBuilder.vb index f67cd5a..208f0d8 100644 --- a/app/DD-Record-Organizer/ClassControlBuilder.vb +++ b/app/DD-Record-Organizer/ClassControlBuilder.vb @@ -180,7 +180,7 @@ Public Class ClassControlBuilder control.BackColor = Color.White control.ForeColor = Color.Black ElseIf control.ReadOnly = True Then - control.BackColor = System.Drawing.SystemColors.Info + control.BackColor = SystemColors.Info control.ForeColor = Color.Black 'System.Drawing.SystemColors.InfoText End If End Sub @@ -1480,8 +1480,8 @@ Public Class ClassControlBuilder End If End If - Me.SetEventHandlers(control) - Me.CurrentControl = DirectCast(control, Label) + SetEventHandlers(control) + CurrentControl = control If Not IsNothing(parent) Then control.Parent = parent @@ -1497,6 +1497,37 @@ Public Class ClassControlBuilder End Sub + Public Sub AddLine(id As Integer, + name As String, + x As Integer, + y As Integer, + color As Integer, + width As Integer, + height As Integer, + _new As Integer, + Optional parent As GroupBox = Nothing, + Optional _designMode As Boolean = False) + Dim line As New LineLabel + line.Tag = New ClassControlMetadata() With { + .Id = id, + .Name = name + } + line.Name = name + + If _new Then + line.Location = GetCursorPosition() + line.Size = New Size(200, 5) + Else + line.Location = New Point(x, y) + line.Size = New Size(width, height) + End If + + CurrentControl = line + + line.Parent = _master_panel + AddToPanel(line) + End Sub + Public Sub AddTextBox(id As Integer, name As String, x As Integer, @@ -2583,4 +2614,8 @@ Public Class ClassControlBuilder MsgBox("Error in AddListBox: " + vbNewLine + ex.Message) End Try End Sub + + Public Class LineLabel + Inherits Label + End Class End Class \ No newline at end of file diff --git a/app/DD-Record-Organizer/ClassControlCommands.vb b/app/DD-Record-Organizer/ClassControlCommands.vb index 9271409..59c9839 100644 --- a/app/DD-Record-Organizer/ClassControlCommands.vb +++ b/app/DD-Record-Organizer/ClassControlCommands.vb @@ -42,6 +42,8 @@ Return 12 Case CurrentType.Contains("ListBoxControl".ToUpper) Return 13 + Case CurrentType.Contains("LineLabel") + Return 14 Case Else Return -1 End Select @@ -100,7 +102,14 @@ ' SQL Befehl für CONTROL TABELLE ' SQL_COMMAND_1 auf leeren String setzen - SQL = "INSERT INTO TBPMO_CONTROL (FORM_ID, CONTROL_TYPE_ID, DEFAULT_VALUE, NAME, COL_NAME, PARENT_CONTROL_ID, SQL_COMMAND_1) VALUES (" & CURRENT_ENTITY_ID & ", " & CONTROL_TYPE_ID & ", '', '" & NAME & "', '" & NAME & "', " & PARENT_CONTROL_ID & ", '')" + + SQL = $""" + INSERT INTO TBPMO_CONTROL + (FORM_ID, CONTROL_TYPE_ID, DEFAULT_VALUE, NAME, COL_NAME, PARENT_CONTROL_ID, SQL_COMMAND_1) + VALUES + ({CURRENT_ENTITY_ID}, {CONTROL_TYPE_ID}, '', '{NAME}', '{NAME}', {PARENT_CONTROL_ID}, '') + """ + 'If LogErrorsOnly = False Then ClassLogger.Add(SQL, True) If ClassDatabase.Execute_non_Query(SQL) = True Then SQL = "SELECT MAX(GUID) FROM TBPMO_CONTROL"