Public Class frmFormDesigner Private _windreamPM As ClassPMWindream Dim CursorPosition As Point Private COLUMN_GUID Private MouseIsDown As Boolean = False ' Used by the MoveMove event handler to show that the ' setup to move the control has completed Private m_Moving As Boolean ''Saves the position 'Private beginX, beginY As Integer Private begin_location As System.Drawing.Point Private end_location As System.Drawing.Point Private idxlbl As Integer = 0 Private idxtxt As Integer = 0 Private idxcmb As Integer = 0 Private idxdtp As Integer = 0 Private idxdgv As Integer = 0 Private idxchk As Integer = 0 Private _loading As Boolean = False Dim frmTableColumn As New frmControl_Detail Private CURRENT_CONTROL As Control Private Sub frmFormDesigner_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing ' 'Try If CURRENT_ProfilGUID > 0 Then Dim DT As DataTable = ClassDatabase.Return_Datatable(String.Format("SELECT * FROM TBPM_PROFILE_CONTROLS WHERE PROFIL_ID = {0} AND (CTRL_TYPE <> 'LBL')", CURRENT_ProfilGUID), True) gbx_CTRL.Visible = False For Each row As DataRow In DT.Rows If row.Item("INDEX_NAME").GetType.ToString.ToLower = "system.dbnull" Or row.Item("INDEX_NAME").ToString = "" Then MsgBox("Für das Control '" & row.Item("NAME") & "' wurde noch keine Indexdefintion hinterlegt!", MsgBoxStyle.Exclamation, "Unvollständige Konfiguration:") e.Cancel = True gbx_CTRL.Visible = True End If Next End If If Application.OpenForms().OfType(Of frmControl_Detail).Any Then frmControl_Detail.Close() End If ' MessageBox.Show("Opened") 'Catch ex As Exception ' MsgBox("Fehler bei FormClosing: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") 'End Try End Sub '' Used to store the current cursor shape when we start '' to move the control 'Private m_CurrentCursor As Cursor '' Holds the mouse position relative to the inside of '' our control when the mouse button goes down 'Private m_CursorOffset As Point Private Sub frmFormDesigner_Load(sender As Object, e As System.EventArgs) Handles Me.Load Try Me.lblDesign.Text = "FormDesigner für Profil: " & CURRENT_ProfilName 'löscht alle Controls pnldesigner.Controls.Clear() Try ' Windream instanziieren _windreamPM = New ClassPMWindream() 'Windream initialisieren (Connection, Session, ... aufbauen) _windreamPM.Init() Catch ex As Exception MsgBox("Fehler bei Initialisieren von windream: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") End Try Try TBPM_PROFILE_CONTROLSTableAdapter.Connection.ConnectionString = MyConnectionString TBPM_CONNECTIONTableAdapter.Connection.ConnectionString = MyConnectionString TBWH_CHECK_PROFILE_CONTROLSTableAdapter.Connection.ConnectionString = MyConnectionString Me.TBPM_CONTROL_TABLETableAdapter.Connection.ConnectionString = MyConnectionString Me.TBPM_CONNECTIONTableAdapter.Fill(Me.DD_DMSLiteDataSet.TBPM_CONNECTION) Catch ex As Exception MsgBox("Fehler bei Laden der Connection-Strings und Grunddaten: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") End Try Load_indexe() Controls_laden() Catch ex As System.Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "error loading form:") End Try End Sub Sub Load_indexe() Me.cmbIndex.Items.Clear() Dim indexe = _windreamPM.GetIndicesByObjecttype(CURRENT_OBJECTTYPE) If indexe IsNot Nothing Then Me.cmbIndex.Items.Add("") For Each index As String In indexe Me.cmbIndex.Items.Add(index) Next Me.cmbIndex.Items.Add("DD PM-ONLY FOR DISPLAY") Me.cmbIndex.SelectedIndex = -1 End If End Sub Sub Load_Indexe_Vektor() Try Me.cmbIndex.Items.Clear() Dim indexe = _windreamPM.GetIndicesByObjecttype(CURRENT_OBJECTTYPE) If indexe IsNot Nothing Then Me.cmbIndex.Items.Add("") For Each index As String In indexe Dim _vektorString As Boolean = False 'If index.StartsWith("Vektor") Or index.StartsWith("vkt") Then ' MsgBox(_windreamPM.GetTypeOfIndex(index).ToString) 'End If Select Case _windreamPM.GetTypeOfIndex(index) Case 4107 'Vektor Zahl _vektorString = True Case 4097 _vektorString = True Case Else _vektorString = False End Select If _vektorString = True Then Me.cmbIndex.Items.Add(index) End If Next End If Catch ex As Exception MsgBox("Fehler bei Indexe Volltext eintragen: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") End Try End Sub Sub Load_Control(Optional ID As Integer = 0) _loading = True Try TabControlEigenschaften.SelectedIndex = 0 Me.cmbIndex.Visible = False Me.INDEX_NAMETextBox.Visible = False If ID = 0 Then CURRENT_CONTROL_ID = CURRENT_CONTROL.Tag Else CURRENT_CONTROL_ID = ID End If If CURRENT_CONTROL_ID <> 0 Then TBPM_PROFILE_CONTROLSTableAdapter.Fill(DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS, CURRENT_CONTROL_ID) Dim dt As DataTable = DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS Dim dr As DataRow = dt.Rows(0) If dr Is Nothing = False Then ' MsgBox(dr.Item("INDEX_NAME").ToString) If dr.Item("INDEX_NAME").ToString.StartsWith("[%VKT") Then Me.rbVektor.Checked = True Me.rbIndex.Checked = False Me.INDEX_NAMETextBox.Visible = True Me.cmbIndex.Visible = False Me.INDEX_NAMETextBox.Text = dr.Item("INDEX_NAME").ToString.Replace("[%VKT", "") Else Me.rbIndex.Checked = True Me.rbVektor.Checked = False Me.INDEX_NAMETextBox.Visible = False Me.cmbIndex.Visible = True IDX_CMB(CURRENT_CONTROL.Name) End If Try If CheckBoxAuswahlliste.Visible = False Then _loading = False Exit Sub End If If dr.Item("CHOICE_LIST") <> "" Then CheckBoxAuswahlliste.Checked = True CHOICE_LISTTextBox.Text = dr.Item("CHOICE_LIST") End If Catch ex As Exception CheckBoxAuswahlliste.Checked = False End Try End If Else tslblAenderungen.Visible = True tslblAenderungen.Text = "Konte das aktuelle Control nicht wählen!!" End If btnsave.Visible = True Catch ex As Exception If Not ex.Message.Contains("Data Reader") Then MsgBox("Fehler bei Laden des Controls: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") End If End Try _loading = False End Sub Sub Controls_laden() Try Me.TBPM_PROFILE_CONTROLSTableAdapter.FillByProfil(Me.DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS, CURRENT_ProfilGUID) 'löscht alle Controls pnldesigner.Controls.Clear() Dim dt As DataTable = DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS For Each dr As DataRow In dt.Rows Select Case dr.Item("CTRL_TYPE") Case "TXT" add_exisiting_textbox(dr.Item("GUID"), dr.Item("NAME"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), CInt(dr.Item("WIDTH")), CInt(dr.Item("HEIGHT"))) Case "LBL" add_existing_label(dr.Item("GUID"), dr.Item("NAME"), dr.Item("CTRL_TEXT"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), CInt(dr.Item("WIDTH")), CInt(dr.Item("HEIGHT"))) Case "CMB" add_exisiting_Combobox(dr.Item("GUID"), dr.Item("NAME"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), CInt(dr.Item("WIDTH")), CInt(dr.Item("HEIGHT"))) Case "DTP" add_exisiting_DTP(dr.Item("GUID"), dr.Item("NAME"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), CInt(dr.Item("WIDTH")), CInt(dr.Item("HEIGHT"))) Case "DGV" add_exisitingDGV(dr.Item("GUID"), dr.Item("NAME"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), CInt(dr.Item("WIDTH")), CInt(dr.Item("HEIGHT"))) Case "CHK" add_exisiting_Checkbox(dr.Item("GUID"), dr.Item("NAME"), dr.Item("CTRL_TEXT"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), CInt(dr.Item("WIDTH")), CInt(dr.Item("HEIGHT"))) Case "TABLE" add_exisitingTABLE(dr.Item("GUID"), dr.Item("NAME"), CInt(dr.Item("X_LOC")), CInt(dr.Item("Y_LOC")), CInt(dr.Item("WIDTH")), CInt(dr.Item("HEIGHT"))) End Select Next Catch ex As Exception MsgBox("Fehler bei Controls_laden: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") End Try End Sub Private Sub DragDropButtons_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles btnlabel.MouseDown, btntextbox.MouseDown, btncmb.MouseDown, btndtp.MouseDown, btnVektor.MouseDown, btnTabelle.MouseDown, btnCheckbox.MouseDown MouseIsDown = True CURRENT_CONTROL = Nothing TBPM_PROFILE_CONTROLSBindingSource.Clear() End Sub Private Sub btnlabel_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles btnlabel.MouseMove If MouseIsDown Then ' Initiate dragging. btnlabel.DoDragDrop("lbl", DragDropEffects.Copy) End If MouseIsDown = False End Sub Private Sub btntextbox_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles btntextbox.MouseMove If MouseIsDown Then ' Initiate dragging. btntextbox.DoDragDrop("txt", DragDropEffects.Copy) End If MouseIsDown = False End Sub Private Sub Panel2_DragDrop(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles pnldesigner.DragDrop Dim r As New System.Random() Dim a As Byte Dim random As Integer = r.Next(8, 100) Select Case e.Data.GetData(DataFormats.Text) Case "lbl" 'idxlbl += 1 add_newlabel("lbl" & random.ToString) Case "txt" 'idxtxt += 1 add_newtextbox("txt" & random) Case "cmb" 'idxcmb += 1 add_newCombobox("cmb" & random) Case "dtp" 'idxdtp += 1 add_newDTP("dtp" & random) Case "dgv" 'idxdgv += 1 add_newDGV("dgv" & random) Case "chk" ' idxchk += 1 add_newCheckbox("chk" & random) Case "tb" add_newTABLE("tb" & random) End Select End Sub Private Sub Panel2_DragEnter(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles pnldesigner.DragEnter ' Check the format of the data being dropped. If (e.Data.GetDataPresent(DataFormats.Text)) Then ' Display the copy cursor. e.Effect = DragDropEffects.Copy Else ' Display the no-drop cursor. e.Effect = DragDropEffects.None End If End Sub Private Function GetControlGUID(control_name As String) Try CURRENT_CONTROL_ID = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(CURRENT_ProfilGUID, control_name) Return CURRENT_CONTROL_ID Catch ex As Exception MsgBox("Fehler bei GetControlGUID: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Achtung:") Return 0 End Try End Function Function add_newlabel(lblname As String) Try Dim lbl As New Label lbl.Name = lblname lbl.Text = "Bez. definieren" lbl.AutoSize = True 'lbl.Size = New Size(CInt(lbl.Text.Length * 10), 16) 'lbl.Size = New Size(300, 27) Dim clientPosition As Point = Me.pnldesigner.PointToClient(System.Windows.Forms.Cursor.Position) lbl.Location = New Point(clientPosition) pnldesigner.Controls.Add(lbl) CURRENT_CONTROL = lbl AddHandler lbl.Click, AddressOf OnlblClick AddHandler lbl.MouseDown, AddressOf MovableLabel_MouseDown AddHandler lbl.MouseUp, AddressOf MovableCtrl_MouseUp AddHandler lbl.MouseMove, AddressOf Control_MouseMove 'MovableLabel_MouseMove TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(CURRENT_ProfilGUID, lbl.Name, "LBL", lblname, lbl.Location.X, lbl.Location.Y, Environment.UserName, 16, 200) CURRENT_CONTROL.Tag = GetLastID() 'Load_Control() btnsave.Visible = True Catch ex As Exception MsgBox("Fehler bei Anlegen Label: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End Function Function add_existing_label(ID As Integer, lblname As String, text As String, x As Integer, y As Integer, vwidth As Integer, vheight As Integer) Dim lbl As New Label lbl.Tag = ID lbl.Name = lblname lbl.Text = text lbl.AutoSize = True 'lbl.Size = New Size(CInt(lbl.Text.Length * 10), vheight) lbl.Location = New Point(x, y) pnldesigner.Controls.Add(lbl) AddHandler lbl.Click, AddressOf OnlblClick AddHandler lbl.MouseDown, AddressOf MovableLabel_MouseDown AddHandler lbl.MouseUp, AddressOf MovableCtrl_MouseUp AddHandler lbl.MouseMove, AddressOf Control_MouseMove 'MovableLabel_MouseMove End Function Private Function GetLastID() Dim sql = String.Format("SELECT MAX(GUID) FROM TBPM_PROFILE_CONTROLS WHERE PROFIL_ID = {0}", CURRENT_ProfilGUID) Return ClassDatabase.Execute_Scalar(sql, MyConnectionString, True) End Function Function add_newtextbox(txtname As String) Try Dim txt As New TextBox txt.Name = txtname txt.Size = New Size(200, 27) txt.Cursor = Cursors.Hand txt.ReadOnly = True Dim clientPosition As Point = Me.pnldesigner.PointToClient(System.Windows.Forms.Cursor.Position) txt.Location = New Point(clientPosition) txt.BackColor = Color.White pnldesigner.Controls.Add(txt) CURRENT_CONTROL = txt AddHandler txt.Click, AddressOf OntxtClick AddHandler txt.MouseDown, AddressOf MovableText_MouseDown AddHandler txt.MouseUp, AddressOf MovableCtrl_MouseUp AddHandler txt.MouseMove, AddressOf Control_MouseMove 'MovableText_MouseMove TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(CURRENT_ProfilGUID, txt.Name, "TXT", txtname, txt.Location.X, txt.Location.Y, Environment.UserName, 27, 200) CURRENT_CONTROL.Tag = GetLastID() 'GetControlGUID(txt.Name) 'Load_Control() btnsave.Visible = True Catch ex As Exception MsgBox("Fehler bei Anlegen TextBox: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End Function Function add_exisiting_textbox(ID As Integer, txtname As String, x As Integer, y As Integer, vwidth As Integer, vheight As Integer) Dim txt As New TextBox txt.Tag = ID txt.Name = txtname If vheight > 27 Then txt.Multiline = True Else txt.Multiline = False End If txt.Size = New Size(vwidth, vheight) txt.Cursor = Cursors.Hand txt.ReadOnly = True txt.Location = New Point(x, y) txt.BackColor = Color.White pnldesigner.Controls.Add(txt) AddHandler txt.Click, AddressOf OntxtClick AddHandler txt.MouseDown, AddressOf MovableText_MouseDown AddHandler txt.MouseUp, AddressOf MovableCtrl_MouseUp AddHandler txt.MouseMove, AddressOf Control_MouseMove 'MovableText_MouseMove btnsave.Visible = True End Function Function add_newCheckbox(chkname As String) Try Dim chk As New CheckBox chk.Name = chkname 'chk.Size = New Size(200, 27) chk.AutoSize = True chk.Text = "Beschriftung def." chk.Cursor = Cursors.Hand Dim clientPosition As Point = Me.pnldesigner.PointToClient(System.Windows.Forms.Cursor.Position) chk.Location = New Point(clientPosition) pnldesigner.Controls.Add(chk) CURRENT_CONTROL = chk AddHandler chk.Click, AddressOf OnchkboxClick AddHandler chk.MouseDown, AddressOf MovableChk_MouseDown AddHandler chk.MouseUp, AddressOf MovableCtrl_MouseUp AddHandler chk.MouseMove, AddressOf Control_MouseMove 'MovableChk_MouseMove TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(CURRENT_ProfilGUID, chk.Name, "CHK", chkname, chk.Location.X, chk.Location.Y, Environment.UserName, 27, 200) CURRENT_CONTROL.Tag = GetLastID() Load_Control() btnsave.Visible = True Catch ex As Exception MsgBox("Fehler bei Anlegen Checkbox: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End Function Function add_exisiting_Checkbox(ID As Integer, chkname As String, text As String, x As Integer, y As Integer, vwidth As Integer, vheight As Integer) Dim chk As New CheckBox chk.Tag = ID chk.Name = chkname chk.AutoSize = True 'chk.Size = New Size(vwidth, vheight) chk.Text = text chk.Cursor = Cursors.Hand chk.Location = New Point(x, y) pnldesigner.Controls.Add(chk) AddHandler chk.Click, AddressOf OnchkboxClick AddHandler chk.MouseDown, AddressOf MovableChk_MouseDown AddHandler chk.MouseUp, AddressOf MovableCtrl_MouseUp AddHandler chk.MouseMove, AddressOf Control_MouseMove 'MovableChk_MouseMove btnsave.Visible = True End Function Function add_newCombobox(cmbname As String) Try Dim cmb As New ComboBox cmb.Name = cmbname cmb.Size = New Size(180, 24) cmb.Cursor = Cursors.Hand Dim clientPosition As Point = Me.pnldesigner.PointToClient(System.Windows.Forms.Cursor.Position) cmb.Location = New Point(clientPosition) pnldesigner.Controls.Add(cmb) CURRENT_CONTROL = cmb AddHandler cmb.Click, AddressOf OncmbClick AddHandler cmb.MouseDown, AddressOf Movablecmb_MouseDown AddHandler cmb.MouseUp, AddressOf MovableCtrl_MouseUp AddHandler cmb.MouseMove, AddressOf Control_MouseMove 'Movablecmb_MouseMove TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(CURRENT_ProfilGUID, cmb.Name, "CMB", cmbname, cmb.Location.X, cmb.Location.Y, Environment.UserName, 24, 180) CURRENT_CONTROL.Tag = GetLastID() Load_Control() btnsave.Visible = True Catch ex As Exception MsgBox("Fehler bei Anlegen Combobox: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End Function Function add_exisiting_Combobox(ID As Integer, cmbname As String, x As Integer, y As Integer, vwidth As Integer, vheight As Integer) Dim cmb As New ComboBox cmb.Tag = ID cmb.Name = cmbname cmb.Size = New Size(vwidth, vheight) cmb.Cursor = Cursors.Hand cmb.Location = New Point(x, y) pnldesigner.Controls.Add(cmb) AddHandler cmb.Click, AddressOf OncmbClick AddHandler cmb.MouseDown, AddressOf Movablecmb_MouseDown AddHandler cmb.MouseUp, AddressOf MovableCtrl_MouseUp AddHandler cmb.MouseMove, AddressOf Control_MouseMove 'Movablecmb_MouseMove btnsave.Visible = True End Function Function add_exisiting_DTP(ID As Integer, dtpname As String, x As Integer, y As Integer, vwidth As Integer, vheight As Integer) Dim dtp As New DateTimePicker dtp.Tag = ID dtp.Name = dtpname dtp.Size = New Size(vwidth, vheight) dtp.Cursor = Cursors.Hand dtp.Location = New Point(x, y) dtp.Format = DateTimePickerFormat.Short pnldesigner.Controls.Add(dtp) AddHandler dtp.Click, AddressOf OndtpClick AddHandler dtp.MouseDown, AddressOf Movabledtp_MouseDown AddHandler dtp.MouseUp, AddressOf MovableCtrl_MouseUp AddHandler dtp.MouseMove, AddressOf Control_MouseMove 'Movabledtp_MouseMove btnsave.Visible = True End Function Function add_newDTP(dtpname As String) Try Dim dtp As New DateTimePicker dtp.Name = dtpname dtp.Size = New Size(180, 24) dtp.Cursor = Cursors.Hand dtp.Format = DateTimePickerFormat.Short Dim clientPosition As Point = Me.pnldesigner.PointToClient(System.Windows.Forms.Cursor.Position) dtp.Location = New Point(clientPosition) pnldesigner.Controls.Add(dtp) CURRENT_CONTROL = dtp AddHandler dtp.Click, AddressOf OndtpClick AddHandler dtp.MouseDown, AddressOf Movabledtp_MouseDown AddHandler dtp.MouseUp, AddressOf MovableCtrl_MouseUp AddHandler dtp.MouseMove, AddressOf Control_MouseMove 'Movabledtp_MouseMove TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(CURRENT_ProfilGUID, dtp.Name, "DTP", dtpname, dtp.Location.X, dtp.Location.Y, Environment.UserName, 24, 180) CURRENT_CONTROL.Tag = GetLastID() Load_Control() Catch ex As Exception MsgBox("Fehler bei Anlegen DatetimePicker: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End Function Function add_exisitingDGV(ID As Integer, dtpname As String, x As Integer, y As Integer, vwidth As Integer, vheight As Integer) Dim dgv As New DataGridView dgv.Tag = ID dgv.Name = dtpname dgv.Size = New Size(vwidth, vheight) dgv.Cursor = Cursors.Hand dgv.Location = New Point(x, y) dgv.AllowUserToAddRows = False dgv.AllowUserToDeleteRows = False dgv.AllowUserToResizeColumns = False dgv.AllowUserToResizeRows = False Dim col As New DataGridViewTextBoxColumn col.HeaderText = "" col.Name = "column1" dgv.Columns.Add(col) pnldesigner.Controls.Add(dgv) AddHandler dgv.Click, AddressOf OndgvClick AddHandler dgv.MouseDown, AddressOf MovableDGV_MouseDown AddHandler dgv.MouseUp, AddressOf MovableCtrl_MouseUp AddHandler dgv.MouseMove, AddressOf dgv_MouseMove btnsave.Visible = True End Function Function add_newDGV(dgvName As String) Try Dim dgv As New DataGridView dgv.Name = dgvName dgv.Size = New Size(130, 150) dgv.Cursor = Cursors.Hand Dim clientPosition As Point = Me.pnldesigner.PointToClient(System.Windows.Forms.Cursor.Position) dgv.Location = New Point(clientPosition) dgv.AllowUserToAddRows = False dgv.AllowUserToDeleteRows = False dgv.AllowUserToResizeColumns = False dgv.AllowUserToResizeRows = False Dim col As New DataGridViewTextBoxColumn col.HeaderText = "" col.Name = "column1" dgv.Columns.Add(col) pnldesigner.Controls.Add(dgv) CURRENT_CONTROL = dgv AddHandler dgv.Click, AddressOf OndgvClick AddHandler dgv.MouseDown, AddressOf MovableDGV_MouseDown AddHandler dgv.MouseUp, AddressOf MovableCtrl_MouseUp AddHandler dgv.MouseMove, AddressOf dgv_MouseMove TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(CURRENT_ProfilGUID, dgv.Name, "DGV", dgvName, dgv.Location.X, dgv.Location.Y, Environment.UserName, 130, 150) CURRENT_CONTROL.Tag = GetLastID() Load_Control() Catch ex As Exception MsgBox("Fehler bei Anlegen DGV: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End Function Function add_newTABLE(tableName As String) Try Dim table As New DataGridView table.Name = tableName table.Size = New Size(200, 150) table.Cursor = Cursors.Hand Dim clientPosition As Point = Me.pnldesigner.PointToClient(System.Windows.Forms.Cursor.Position) table.Location = New Point(clientPosition) table.AllowUserToAddRows = False table.AllowUserToDeleteRows = False table.AllowUserToResizeColumns = True table.AllowUserToResizeRows = False Dim col1 As New DataGridViewTextBoxColumn col1.HeaderText = "Column1" col1.Name = "column1" table.Columns.Add(col1) Dim col2 As New DataGridViewTextBoxColumn col2.HeaderText = "Column2" col2.Name = "column2" table.Columns.Add(col2) pnldesigner.Controls.Add(table) CURRENT_CONTROL = table AddHandler table.Click, AddressOf OndgvClick AddHandler table.MouseDown, AddressOf MovableDGV_MouseDown AddHandler table.MouseUp, AddressOf MovableCtrl_MouseUp AddHandler table.MouseMove, AddressOf dgv_MouseMove AddHandler table.ColumnHeaderMouseClick, AddressOf table_ColumnHeaderMouseClick TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(CURRENT_ProfilGUID, table.Name, "TABLE", tableName, table.Location.X, table.Location.Y, Environment.UserName, 130, 150) CURRENT_CONTROL.Tag = GetLastID() TBPM_CONTROL_TABLETableAdapter.Insert(CURRENT_CONTROL.Tag, "column1", "Column1", 95, Environment.UserName) TBPM_CONTROL_TABLETableAdapter.Insert(CURRENT_CONTROL.Tag, "column2", "Column2", 95, Environment.UserName) Load_Control() Catch ex As Exception MsgBox("Fehler bei Anlegen Tabelle: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End Function Function add_exisitingTABLE(ID As Integer, tableName As String, x As Integer, y As Integer, vwidth As Integer, vheight As Integer) Dim table As New DataGridView table.Tag = ID table.Name = tableName table.Size = New Size(vwidth, vheight) table.Cursor = Cursors.Hand table.Location = New Point(x, y) table.AllowUserToAddRows = False table.AllowUserToDeleteRows = False table.AllowUserToResizeColumns = True table.AllowUserToResizeRows = False CURRENT_CONTROL = table 'Columns laden TBPM_CONTROL_TABLETableAdapter.Fill(Me.DD_DMSLiteDataSet.TBPM_CONTROL_TABLE, table.Tag) Dim DT As DataTable = Me.DD_DMSLiteDataSet.TBPM_CONTROL_TABLE If DT.Rows.Count > 0 Then For Each Row As DataRow In DT.Rows Dim col As New DataGridViewTextBoxColumn col.HeaderText = Row.Item("SPALTEN_HEADER") col.Name = Row.Item("SPALTENNAME") col.Width = Row.Item("SPALTENBREITE") table.Columns.Add(col) Next End If ' table.AutoResizeColumns() pnldesigner.Controls.Add(table) AddHandler table.Click, AddressOf OndgvClick AddHandler table.MouseDown, AddressOf MovableDGV_MouseDown AddHandler table.MouseUp, AddressOf MovableCtrl_MouseUp AddHandler table.MouseMove, AddressOf dgv_MouseMove AddHandler table.ColumnHeaderMouseClick, AddressOf table_ColumnHeaderMouseClick btnsave.Visible = True End Function Sub Set_Active_Color() CURRENT_CONTROL.BackColor = Color.DarkOrange For Each inctrl As Control In Me.pnldesigner.Controls If inctrl.Name <> CURRENT_CONTROL.Name Then Dim Type As String = inctrl.GetType.ToString Select Case Type Case "System.Windows.Forms.TextBox" inctrl.BackColor = Color.White Case "System.Windows.Forms.ComboBox" inctrl.BackColor = Color.White Case "System.Windows.Forms.Label" inctrl.BackColor = Color.Transparent End Select End If Next End Sub Public Sub OnlblClick(sender As System.Object, e As System.EventArgs) CURRENT_CONTROL = sender Set_Active_Color() Dim lbl As Label = sender CURRENT_CONTROL = lbl Load_Control() Me.lblBeschriftung.Visible = True Me.CTRL_TEXTTextBox.Visible = True Me.lblIndex.Visible = False Me.cmbIndex.Visible = False Me.rbIndex.Visible = False Me.rbVektor.Visible = False Me.VALIDATIONCheckBox.Visible = False Me.CheckBoxAuswahlliste.Visible = False Me.CHOICE_LISTTextBox.Visible = False Me.lblAuswahlliste.Visible = False gbx_CTRL.Visible = True ' Me.pnlAuswahlliste.Enabled = False Me.READ_ONLYCheckBox.Visible = False Me.LOAD_IDX_VALUECheckBox.Visible = False INDEX_NAMETextBox.Visible = False End Sub Public Sub OntxtClick(sender As System.Object, e As System.EventArgs) CURRENT_CONTROL = sender Dim txt As TextBox = sender Set_Active_Color() CURRENT_CONTROL = txt Load_indexe() Load_Control() Me.lblBeschriftung.Visible = False Me.CTRL_TEXTTextBox.Visible = False Me.lblIndex.Visible = True Me.cmbIndex.Visible = True Me.rbIndex.Visible = True Me.rbVektor.Visible = True Me.CheckBoxAuswahlliste.Visible = False Me.VALIDATIONCheckBox.Visible = True Me.CheckBoxAuswahlliste.Visible = False Me.CHOICE_LISTTextBox.Visible = False Me.lblAuswahlliste.Visible = False gbx_CTRL.Visible = True ' Me.pnlAuswahlliste.Enabled = False Me.READ_ONLYCheckBox.Visible = True Me.LOAD_IDX_VALUECheckBox.Visible = True End Sub Public Sub OnchkboxClick(sender As System.Object, e As System.EventArgs) CURRENT_CONTROL = sender Dim chk As CheckBox = sender Set_Active_Color() CURRENT_CONTROL = chk Load_indexe() Load_Control() Me.lblBeschriftung.Visible = True Me.CTRL_TEXTTextBox.Visible = True Me.lblIndex.Visible = True Me.cmbIndex.Visible = True Me.rbIndex.Visible = True Me.rbVektor.Visible = True Me.VALIDATIONCheckBox.Visible = True Me.CheckBoxAuswahlliste.Visible = False Me.CHOICE_LISTTextBox.Visible = False Me.lblAuswahlliste.Visible = False gbx_CTRL.Visible = True ' Me.pnlAuswahlliste.Enabled = False Me.READ_ONLYCheckBox.Visible = True Me.LOAD_IDX_VALUECheckBox.Visible = True End Sub Public Sub OncmbClick(sender As System.Object, e As System.EventArgs) CURRENT_CONTROL = sender Dim cmb As ComboBox = sender Set_Active_Color() CURRENT_CONTROL = cmb Load_indexe() Load_Control() Me.lblBeschriftung.Visible = False Me.CTRL_TEXTTextBox.Visible = False Me.lblIndex.Visible = True Me.cmbIndex.Visible = True Me.rbIndex.Visible = True Me.rbVektor.Visible = True Me.CheckBoxAuswahlliste.Visible = True Me.VALIDATIONCheckBox.Visible = True gbx_CTRL.Visible = True If CHOICE_LISTTextBox.Text <> "" Then CheckBoxAuswahlliste.Checked = True Else CheckBoxAuswahlliste.Checked = False End If ' Me.pnlAuswahlliste.Enabled = True Me.READ_ONLYCheckBox.Visible = True Me.LOAD_IDX_VALUECheckBox.Visible = True End Sub Public Sub OndtpClick(sender As System.Object, e As System.EventArgs) CURRENT_CONTROL = sender Dim dtp As DateTimePicker = sender CURRENT_CONTROL = dtp Load_indexe() Load_Control() Me.lblBeschriftung.Visible = False Me.CTRL_TEXTTextBox.Visible = False Me.lblIndex.Visible = True Me.cmbIndex.Visible = True Me.rbIndex.Visible = True Me.rbVektor.Visible = True Me.CheckBoxAuswahlliste.Visible = False Me.VALIDATIONCheckBox.Visible = True gbx_CTRL.Visible = True CHOICE_LISTTextBox.Visible = False ' Me.pnlAuswahlliste.Enabled = False Me.READ_ONLYCheckBox.Visible = True Me.LOAD_IDX_VALUECheckBox.Visible = True End Sub Public Sub OndgvClick(sender As System.Object, e As System.EventArgs) CURRENT_CONTROL = sender Dim dgv As DataGridView = sender CURRENT_CONTROL = dgv If dgv.ColumnCount > 1 Then Me.rbVektor.Visible = False Load_Indexe_Vektor() Dim selectedColumnCount As Integer = dgv.Columns.GetColumnCount(DataGridViewElementStates.Selected) If selectedColumnCount > 0 Then COLUMN_GUID = TBPM_CONTROL_TABLETableAdapter.getColumnID(CURRENT_CONTROL_ID, dgv.SelectedColumns(selectedColumnCount).Name) End If Else Load_indexe() Me.rbVektor.Visible = True COLUMN_GUID = Nothing End If Load_Control() Me.lblBeschriftung.Visible = False Me.CTRL_TEXTTextBox.Visible = False Me.lblIndex.Visible = True Me.cmbIndex.Visible = True Me.rbIndex.Visible = True Me.CheckBoxAuswahlliste.Visible = False Me.CHOICE_LISTTextBox.Visible = False Me.lblAuswahlliste.Visible = False Me.VALIDATIONCheckBox.Visible = True gbx_CTRL.Visible = True CHOICE_LISTTextBox.Visible = False 'Me.pnlAuswahlliste.Enabled = False Me.READ_ONLYCheckBox.Visible = True Me.LOAD_IDX_VALUECheckBox.Visible = True End Sub Public Sub table_ColumnHeaderMouseClick(sender As System.Object, e As DataGridViewCellMouseEventArgs) CURRENT_CONTROL = sender Dim dgv As DataGridView = sender CURRENT_CONTROL = dgv Me.rbVektor.Visible = False Dim dgvColumn As DataGridViewColumn = dgv.Columns(e.ColumnIndex) COLUMN_GUID = TBPM_CONTROL_TABLETableAdapter.getColumnID(CURRENT_CONTROL_ID, dgvColumn.Name) If Application.OpenForms().OfType(Of frmControl_Detail).Any Then ' MessageBox.Show("Opened") Else frmTableColumn = New frmControl_Detail frmTableColumn.Show() End If frmTableColumn.FillData(COLUMN_GUID) frmTableColumn.Text = "Konfiguration von Spalte: " & dgvColumn.Name Load_Control() Me.lblBeschriftung.Visible = True Me.CTRL_TEXTTextBox.Visible = True Me.lblIndex.Visible = True Me.cmbIndex.Visible = True Me.rbIndex.Visible = True Me.CheckBoxAuswahlliste.Visible = False Me.CHOICE_LISTTextBox.Visible = False Me.lblAuswahlliste.Visible = False Me.VALIDATIONCheckBox.Visible = True gbx_CTRL.Visible = True ' Me.pnlAuswahlliste.Enabled = False Me.READ_ONLYCheckBox.Visible = True Me.LOAD_IDX_VALUECheckBox.Visible = True End Sub Sub IDX_CMB(controlname As String) Try Dim guid As Integer = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(CURRENT_ProfilGUID, controlname) Dim indexname As String = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetIndexname(guid) 'If indexname.StartsWith("[%") Then ' indexname = indexname.Replace("[%", "") 'End If cmbIndex.SelectedIndex = cmbIndex.FindStringExact(indexname) Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "IDX_CMB:") End Try End Sub Sub delete_Control(_ctrlname As String) Try Dim result As MsgBoxResult = MsgBox("Wollen Sie das Control: " & _ctrlname & " wirklich löschen?", MsgBoxStyle.YesNo, "Bestätigung:") ' wenn Speichern ja If result = MsgBoxResult.Yes Then Dim guid As Integer = TBPM_PROFILE_CONTROLSTableAdapter.cmdGetGUID(CURRENT_ProfilGUID, _ctrlname) If guid > 0 Then Me.TBPM_CONTROL_TABLETableAdapter.Delete(guid) TBPM_PROFILE_CONTROLSTableAdapter.Delete(guid) Controls_laden() End If End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "delete_Control:") End Try End Sub ' +++ Public Helper Methods +++ Public Function GetCursorPosition() As Point Return pnldesigner.PointToClient(Cursor.Position) End Function Sub Clear_control_Details() Try CURRENT_CONTROL = Nothing TBPM_PROFILE_CONTROLSBindingSource.Clear() Catch ex As Exception End Try End Sub Private Sub MovableLabel_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown ' Check to see if the correct button has been pressed If e.Button = Windows.Forms.MouseButtons.Left Then Clear_control_Details() ' MsgBox(ex.Message) Dim lbl As Label = DirectCast(sender, Label) CURRENT_CONTROL = sender begin_location = e.Location lbl.BringToFront() ' Set the mode flag to signal the MouseMove event handler that it ' needs to now calculate new positions for our control m_Moving = True End If End Sub Private Sub MovableText_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown ' Check to see if the correct button has been pressed If e.Button = Windows.Forms.MouseButtons.Left Then Clear_control_Details() Dim txt As TextBox = DirectCast(sender, TextBox) CURRENT_CONTROL = sender begin_location = e.Location txt.BringToFront() ' Set the mode flag to signal the MouseMove event handler that it ' needs to now calculate new positions for our control m_Moving = True End If End Sub Private Sub MovableChk_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown ' Check to see if the correct button has been pressed If e.Button = Windows.Forms.MouseButtons.Left Then Clear_control_Details() Dim txt As CheckBox = DirectCast(sender, CheckBox) CURRENT_CONTROL = sender begin_location = e.Location txt.BringToFront() ' Set the mode flag to signal the MouseMove event handler that it ' needs to now calculate new positions for our control m_Moving = True End If End Sub Private Sub Movablecmb_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown ' Check to see if the correct button has been pressed If e.Button = Windows.Forms.MouseButtons.Left Then Clear_control_Details() Dim cmb As ComboBox = DirectCast(sender, ComboBox) CURRENT_CONTROL = sender begin_location = e.Location cmb.BringToFront() ' Set the mode flag to signal the MouseMove event handler that it ' needs to now calculate new positions for our control m_Moving = True End If End Sub Private Sub Movabledtp_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown ' Check to see if the correct button has been pressed If e.Button = Windows.Forms.MouseButtons.Left Then Clear_control_Details() Dim dtp As DateTimePicker = DirectCast(sender, DateTimePicker) CURRENT_CONTROL = sender 'Console.WriteLine("X: " & cursor.X & ";Y=" & cursor.Y) begin_location = e.Location 'begin_location = New Point(cursor.X - Parent.Location.X, ' cursor.Y - Parent.Location.Y) dtp.BringToFront() ' Set the mode flag to signal the MouseMove event handler that it ' needs to now calculate new positions for our control m_Moving = True 'Jetzt Controleigenschaften laden Load_Control() End If End Sub Private Sub MovableDGV_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown ' Check to see if the correct button has been pressed If e.Button = Windows.Forms.MouseButtons.Left And Cursor = Cursors.Default Then Clear_control_Details() Dim dgv As DataGridView = DirectCast(sender, DataGridView) Dim relativeMousePosition As Point = dgv.PointToClient(Cursor.Position) Dim hit As DataGridView.HitTestInfo = dgv.HitTest(relativeMousePosition.X, relativeMousePosition.Y) If hit.Type.ToString = "ColumnHeader" Then Exit Sub End If CURRENT_CONTROL = sender begin_location = e.Location CURRENT_CONTROL.Tag = New clsDragInfo(Form.MousePosition, sender.Location) dgv.BringToFront() ' Set the mode flag to signal the MouseMove event handler that it ' needs to now calculate new positions for our control m_Moving = True CURRENT_CONTROL = sender 'Jetzt Controleigenschaften laden Set_Active_Color() Load_Control() gbx_CTRL.Visible = True End If End Sub Private Sub MovableCtrl_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp CURRENT_CONTROL.Tag = Nothing ' The button was released, so we're going back to Static mode. If m_Moving = True Then m_Moving = False end_location = e.Location If X_LOCTextBox.Text <> String.Empty Then If CURRENT_CONTROL.Location.X <> X_LOCTextBox.Text Or CURRENT_CONTROL.Location.Y <> Y_LOCTextBox.Text Then X_LOCTextBox.Text = CURRENT_CONTROL.Location.X Y_LOCTextBox.Text = CURRENT_CONTROL.Location.Y Save_Control() End If End If 'Y_LOCTextBox.Text = end_location.Y 'Save_Control() End If ' Restore the cursor image to the way we found it when the mouse ' button was pressed MyBase.Cursor = Cursors.Default End Sub Private Sub Control_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove Try If CURRENT_CONTROL Is Nothing Then Exit Sub End If 'Check which mode we're in. If we're supposed to be moving 'our control If m_Moving = True And sender.ToString <> "DD_PM_WINDREAM.frmFormDesigner, Text: Validation-Designer" Then Me.Cursor = Cursors.Hand Me.Refresh() Dim NowCursor As Point = GetCursorPosition() ' get the screen position of the mouse pointer and map it ' to the position relative to the top-left corner of our If Point.op_Inequality(NowCursor, begin_location) Then CURRENT_CONTROL.Location = New System.Drawing.Point(NowCursor.X - begin_location.X, NowCursor.Y - begin_location.Y) End If End If Catch ex As Exception ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "MovableLabel_MouseMove") m_Moving = False End Try End Sub Private Sub MovableLabel_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove Try If CURRENT_CONTROL Is Nothing Then Exit Sub End If 'Check which mode we're in. If we're supposed to be moving 'our control If m_Moving = True And sender.ToString <> "DD_PM_WINDREAM.frmFormDesigner, Text: Validation-Designer" And CURRENT_CONTROL.GetType.ToString = "System.Windows.Forms.Label" Then Me.Cursor = Cursors.Hand Me.Refresh() Dim lbl As Label = DirectCast(sender, Label) Dim NowCursor As Point = GetCursorPosition() ' get the screen position of the mouse pointer and map it ' to the position relative to the top-left corner of our If Point.op_Inequality(NowCursor, begin_location) Then lbl.Location = New System.Drawing.Point(NowCursor.X - begin_location.X, NowCursor.Y - begin_location.Y) End If End If Catch ex As Exception ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "MovableLabel_MouseMove") m_Moving = False End Try End Sub Private Sub MovableText_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove 'Check which mode we're in. If we're supposed to be moving 'our control If CURRENT_CONTROL Is Nothing Then Exit Sub End If Try If m_Moving = True And sender.ToString <> "DD_PM_WINDREAM.frmFormDesigner, Text: Validation-Designer" And CURRENT_CONTROL.GetType.ToString = "System.Windows.Forms.TextBox" Then Me.Cursor = Cursors.Hand Me.Refresh() Dim txt As TextBox = DirectCast(sender, TextBox) Dim NowCursor As Point = GetCursorPosition() ' get the screen position of the mouse pointer and map it ' to the position relative to the top-left corner of our ' parent container If Point.op_Inequality(NowCursor, begin_location) Then txt.Location = New System.Drawing.Point(NowCursor.X - begin_location.X, NowCursor.Y - begin_location.Y) End If End If Catch ex As Exception ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "MovableText_MouseMove") m_Moving = False End Try End Sub Private Sub MovableChk_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove 'Check which mode we're in. If we're supposed to be moving 'our control If CURRENT_CONTROL Is Nothing Then Exit Sub End If Try If m_Moving = True And sender.ToString <> "DD_PM_WINDREAM.frmFormDesigner, Text: Validation-Designer" And CURRENT_CONTROL.GetType.ToString = "System.Windows.Forms.CheckBox" Then Me.Cursor = Cursors.Hand Me.Refresh() Dim chk As CheckBox = DirectCast(sender, CheckBox) Dim NowCursor As Point = GetCursorPosition() ' get the screen position of the mouse pointer and map it ' to the position relative to the top-left corner of our If Point.op_Inequality(NowCursor, begin_location) Then chk.Location = New System.Drawing.Point(NowCursor.X - begin_location.X, NowCursor.Y - begin_location.Y) End If End If Catch ex As Exception ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "MovableChk_MouseMove") m_Moving = False End Try End Sub Private Sub Movablecmb_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove 'Check which mode we're in. If we're supposed to be moving 'our control If CURRENT_CONTROL Is Nothing Then Exit Sub End If Try If m_Moving = True And sender.ToString <> "DD_PM_WINDREAM.frmFormDesigner, Text: Validation-Designer" And CURRENT_CONTROL.GetType.ToString = "System.Windows.Forms.ComboBox" Then Me.Cursor = Cursors.Hand Me.Refresh() Dim cmb As ComboBox = DirectCast(sender, ComboBox) Static LastCursor As Point Dim NowCursor As Point = GetCursorPosition() ' get the screen position of the mouse pointer and map it ' to the position relative to the top-left corner of our If Point.op_Inequality(NowCursor, begin_location) Then cmb.Location = New System.Drawing.Point(NowCursor.X - begin_location.X, NowCursor.Y - begin_location.Y) End If End If Catch ex As Exception ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Movablecmb_MouseMove") m_Moving = False End Try End Sub 'Private Sub Movabledtp_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove ' 'Check which mode we're in. If we're supposed to be moving ' 'our control ' If CURRENT_CONTROL Is Nothing Then ' Exit Sub ' End If ' Try ' If m_Moving = True And sender.ToString <> "DD_PM_WINDREAM.frmFormDesigner, Text: Validation-Designer" And CURRENT_CONTROL.GetType.ToString = "System.Windows.Forms.DateTimePicker" Then ' Me.Cursor = Cursors.Hand ' Me.Refresh() ' Dim dtp As DateTimePicker = DirectCast(sender, DateTimePicker) ' Static LastCursor As Point ' Dim NowCursor = GetCursorPosition() ' New Point(Cursor.Position.X, Cursor.Position.Y) ' ' Console.WriteLine("NOW X: " & NowCursor.X & ";Y=" & NowCursor.Y) ' ' get the screen position of the mouse pointer and map it ' ' to the position relative to the top-left corner of our ' ' parent container ' If Point.op_Inequality(NowCursor, begin_location) Then ' 'dtp.Location = New System.Drawing.Point(NowCursor.X - pnldesigner.Location.X, NowCursor.Y - pnldesigner.Location.Y) ' ' Alle normalen Controls ' dtp.Location = New Point(NowCursor.X - begin_location.X, ' NowCursor.Y - begin_location.Y) ' 'dtp.Location = New System.Drawing.Point(clientPosition.X - begin_location.X, clientPosition.Y - begin_location.Y) ' End If ' End If ' Catch ex As Exception ' ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Movablecmb_MouseMove") ' m_Moving = False ' End Try 'End Sub Private Sub dgv_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove 'Check which mode we're in. If we're supposed to be moving 'our control If CURRENT_CONTROL Is Nothing Then Exit Sub End If Try If m_Moving = True And sender.ToString <> "DD_PM_WINDREAM.frmFormDesigner, Text: Validation-Designer" And CURRENT_CONTROL.GetType.ToString = "System.Windows.Forms.DataGridView" Then Me.Cursor = Cursors.Hand Me.Refresh() Dim dgv As DataGridView = DirectCast(sender, DataGridView) Static LastCursor As Point Dim NowCursor As Point = New Point(Cursor.Position.X, Cursor.Position.Y) ' get the screen position of the mouse pointer and map it ' to the position relative to the top-left corner of our ' parent container Dim clientPosition As Point = Me.pnldesigner.PointToClient(System.Windows.Forms.Cursor.Position) If Point.op_Inequality(NowCursor, LastCursor) Then dgv.Location = New System.Drawing.Point(clientPosition.X - begin_location.X, clientPosition.Y - begin_location.Y) End If End If Catch ex As Exception ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Movablecmb_MouseMove") m_Moving = False End Try End Sub 'Private Sub dgv_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove ' 'Check which mode we're in. If we're supposed to be movingmybase ' 'our control ' Try ' If CURRENT_CONTROL.Tag IsNot Nothing Then ' Dim info As clsDragInfo = CType(Panel1.Tag, clsDragInfo) ' Dim newLoc As Point = info.NewLocation(Form.MousePosition) ' If Me.ClientRectangle.Contains(New Rectangle(newLoc, CURRENT_CONTROL.Size)) Then CURRENT_CONTROL.Location = newLoc ' End If ' 'If m_Moving = True Then ' ' ListBox1.Items.Add(sender.ToString & "-" & CURRENT_CONTROL.GetType.ToString) ' 'End If ' 'If m_Moving = True And sender.ToString <> "DD_PM_WINDREAM.frmFormDesigner, Text: Validation-Designer" And CURRENT_CONTROL.GetType.ToString = "System.Windows.Forms.DateTimePicker" Then ' ' Me.Cursor = Cursors.Hand ' ' Me.Refresh() ' ' Dim dgv As DataGridView = DirectCast(sender, DataGridView) ' ' Static LastCursor As Point ' ' Dim NowCursor As Point = New Point(Cursor.Position.X, Cursor.Position.Y) ' ' ' get the screen position of the mouse pointer and map it ' ' ' to the position relative to the top-left corner of our ' ' ' parent container ' ' Dim clientPosition As Point = Me.pnldesigner.PointToClient(System.Windows.Forms.Cursor.Position) ' ' If Point.op_Inequality(NowCursor, LastCursor) Then ' ' dgv.Location = New System.Drawing.Point(clientPosition.X - begin_location.X, clientPosition.Y - begin_location.Y) ' ' End If ' 'End If ' Catch ex As Exception ' ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Movabledgv_MouseMove") ' 'm_Moving = False ' End Try 'End Sub Private Sub btnsave_Click(sender As System.Object, e As System.EventArgs) Handles btnsave.Click Save_Control() End Sub Sub Save_Control() Try If rbVektor.Checked Then If INDEX_NAMETextBox.Text = "" Then MsgBox("Bitte definieren Sie den Bezeichner für dieses Processmanager-Item:", MsgBoxStyle.Exclamation) Me.INDEX_NAMETextBox.BackColor = Color.Red Exit Sub Else Me.INDEX_NAMETextBox.BackColor = Color.White End If ' INDEX_NAME_VALUE.Text = "[%VKT" & INDEX_NAMETextBox.Text End If TBPM_PROFILE_CONTROLSBindingSource.EndEdit() If DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS.GetChanges Is Nothing = False Then Me.CHANGED_WHOTextBox.Text = Environment.UserName TBPM_PROFILE_CONTROLSBindingSource.EndEdit() TBPM_PROFILE_CONTROLSTableAdapter.Update(DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS) tslblAenderungen.Visible = True tslblAenderungen.Text = "Änderungen gespeichert - " & Now Else tslblAenderungen.Visible = False End If 'Wenn Datagridview dann Speichern Dim type As String = CURRENT_CONTROL.GetType.ToString If type.Contains("DataGridView") Then Dim dgv As DataGridView = DirectCast(CURRENT_CONTROL, DataGridView) If dgv.ColumnCount > 1 Then 'For Each col As DataColumn In dgv.Columns ' MsgBox(col.ColumnName) 'Next End If End If Catch ex As Exception If ex.Message.ToLower.Contains("interne datatable") = True Or ex.Message.ToLower.Contains("internal index is corrupted") = True Then Save_Control() ElseIf ex.Message.ToLower.Contains("geöffneter datareader") = True Then Exit Sub Else MsgBox(ex.Message, MsgBoxStyle.Critical, "Save Control:") End If End Try End Sub Private Sub cmbIndex_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cmbIndex.SelectedIndexChanged If cmbIndex.SelectedIndex <> -1 Then If cmbIndex.Text = "DD PM-ONLY FOR DISPLAY" Then LOAD_IDX_VALUECheckBox.Checked = False LOAD_IDX_VALUECheckBox.Enabled = False READ_ONLYCheckBox.Checked = True VALIDATIONCheckBox.Checked = False VALIDATIONCheckBox.Enabled = False Else LOAD_IDX_VALUECheckBox.Enabled = True VALIDATIONCheckBox.Enabled = True End If If _loading = False Then Save_Control() End If End If End Sub Private Sub btncmb_MouseMove(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles btncmb.MouseMove If MouseIsDown Then ' Initiate dragging. btncmb.DoDragDrop("cmb", DragDropEffects.Copy) End If MouseIsDown = False End Sub Private Sub CheckBox1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBoxAuswahlliste.CheckedChanged If CheckBoxAuswahlliste.Checked Then lblAuswahlliste.Visible = True CHOICE_LISTTextBox.Visible = True Else lblAuswahlliste.Visible = False CHOICE_LISTTextBox.Visible = False End If End Sub Private Sub btndelete_Click(sender As System.Object, e As System.EventArgs) Handles btndelete.Click If CURRENT_CONTROL Is Nothing = False Then delete_Control(CURRENT_CONTROL.Name) End If End Sub Private Sub CTRL_TEXTTextBox_LostFocus(sender As Object, e As System.EventArgs) Handles CTRL_TEXTTextBox.LostFocus Try Dim type As String = CURRENT_CONTROL.GetType.ToString If type.Contains("Label") Then TBPM_PROFILE_CONTROLSBindingSource.EndEdit() End If Catch ex As Exception MsgBox("Fehler bei CTRL_TEXTTextBox.LostFocus:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try If CURRENT_CONTROL.Text <> CTRL_TEXTTextBox.Text Then CURRENT_CONTROL.Text = CTRL_TEXTTextBox.Text CTRL_TEXTTextBox.Text = CURRENT_CONTROL.Text Save_Control() End If End Sub Private Sub NAMETextBox_LostFocus(sender As Object, e As System.EventArgs) Handles NAMETextBox.LostFocus Try Dim type As String = CURRENT_CONTROL.GetType.ToString If type.Contains("TextBox") Then TBPM_PROFILE_CONTROLSBindingSource.EndEdit() End If Catch ex As Exception MsgBox("Fehler bei NAMETextBox.LostFocus:" & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try If CURRENT_CONTROL.Name <> NAMETextBox.Text Then Save_Control() End If End Sub Private Sub btnwidth_plus_Click(sender As System.Object, e As System.EventArgs) Handles btnwidth_plus.Click If CURRENT_CONTROL Is Nothing = False Then CURRENT_CONTROL.Size = New Size(CURRENT_CONTROL.Width + 5, CURRENT_CONTROL.Height) WIDTHTextBox.Text = CURRENT_CONTROL.Size.Width Save_Control() End If End Sub Private Sub btnwidth_minus_Click(sender As System.Object, e As System.EventArgs) Handles btnwidth_minus.Click If CURRENT_CONTROL Is Nothing = False Then CURRENT_CONTROL.Size = New Size(CURRENT_CONTROL.Width - 5, CURRENT_CONTROL.Height) WIDTHTextBox.Text = CURRENT_CONTROL.Size.Width Save_Control() End If End Sub Private Sub btnheight_plus_Click(sender As System.Object, e As System.EventArgs) Handles btnheight_plus.Click If CURRENT_CONTROL Is Nothing = False Then Dim height As Integer = CURRENT_CONTROL.Height height += 5 If height > 21 Then Dim txt As TextBox = DirectCast(CURRENT_CONTROL, TextBox) txt.Multiline = True End If CURRENT_CONTROL.Size = New Size(CURRENT_CONTROL.Width, height) HEIGHTTextBox.Text = height Save_Control() End If End Sub Private Sub btnheight_minus_Click(sender As System.Object, e As System.EventArgs) Handles btnheight_minus.Click If CURRENT_CONTROL Is Nothing = False Then Dim height As Integer = CURRENT_CONTROL.Height height -= 5 If height < 22 Then Dim txt As TextBox = DirectCast(CURRENT_CONTROL, TextBox) txt.Multiline = False End If CURRENT_CONTROL.Size = New Size(CURRENT_CONTROL.Width, height) HEIGHTTextBox.Text = height Save_Control() End If End Sub Private Sub Button2_MouseMove(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles btndtp.MouseMove If MouseIsDown Then 'Initiate dragging. btndtp.DoDragDrop("dtp", DragDropEffects.Copy) End If MouseIsDown = False End Sub Private Sub btnVektor_MouseMove(sender As Object, e As MouseEventArgs) Handles btnVektor.MouseMove If MouseIsDown Then 'Initiate dragging. btnVektor.DoDragDrop("dgv", DragDropEffects.Copy) End If MouseIsDown = False End Sub Private Sub btnTabelle_MouseMove(sender As Object, e As MouseEventArgs) Handles btnTabelle.MouseMove If MouseIsDown Then 'Initiate dragging. btnVektor.DoDragDrop("tb", DragDropEffects.Copy) End If MouseIsDown = False End Sub Private Sub Button1_MouseMove(sender As Object, e As MouseEventArgs) Handles btnCheckbox.MouseMove If MouseIsDown Then 'Initiate dragging. btnCheckbox.DoDragDrop("chk", DragDropEffects.Copy) End If MouseIsDown = False End Sub Private Sub rbIndex_CheckedChanged(sender As Object, e As EventArgs) Handles rbIndex.CheckedChanged If rbIndex.Checked Then Me.cmbIndex.Visible = True Me.INDEX_NAMETextBox.Visible = False Me.lblIndex.Text = "Zugeordneter Index" Else Me.cmbIndex.Visible = False Me.INDEX_NAMETextBox.Visible = True Me.lblIndex.Text = "Bezeichner und getätigte Eingabe werden in das Vektorfeld geschrieben" End If End Sub Private Sub rbVektor_CheckedChanged(sender As Object, e As EventArgs) Handles rbVektor.CheckedChanged If rbVektor.Checked Then Me.INDEX_NAMETextBox.Visible = True Me.cmbIndex.Visible = False Me.lblIndex.Text = "Bezeichner und getätigte Eingabe werden in das Vektorfeld geschrieben" Else Me.INDEX_NAMETextBox.Visible = False Me.cmbIndex.Visible = True Me.lblIndex.Text = "Zugeordneter Index" End If End Sub Private Sub INDEX_NAMETextBox_Leave(sender As Object, e As EventArgs) Handles INDEX_NAMETextBox.Leave If INDEX_NAMETextBox.Text <> "" And CURRENT_CONTROL_ID <> 0 Then TBPM_PROFILE_CONTROLSTableAdapter.cmdUpdateIndexname("[%VKT" & INDEX_NAMETextBox.Text, Environment.UserName, CURRENT_CONTROL_ID) End If End Sub Private Sub READ_ONLYCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles READ_ONLYCheckBox.CheckedChanged If READ_ONLYCheckBox.Checked Then Me.VALIDATIONCheckBox.Checked = True Me.LOAD_IDX_VALUECheckBox.Checked = True End If End Sub Private Sub btnrefresh_Click(sender As Object, e As EventArgs) Handles btnrefresh.Click Controls_laden() End Sub Private Sub btnShowConnections_Click(sender As Object, e As EventArgs) Handles btnShowConnections.Click frmConnection.ShowDialog() Try Me.TBPM_CONNECTIONTableAdapter.Fill(Me.DD_DMSLiteDataSet.TBPM_CONNECTION) Catch ex As Exception ClassLogger.Add(ex.Message) End Try End Sub Private Sub btnEditor_Click(sender As Object, e As EventArgs) Handles btnEditor.Click Dim CONID = 0 If cmbConnection.SelectedValue > 0 Then CONID = cmbConnection.SelectedValue End If TBPM_PROFILE_CONTROLSBindingSource.EndEdit() If DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS.GetChanges Is Nothing = False Then Me.CHANGED_WHOTextBox.Text = Environment.UserName TBPM_PROFILE_CONTROLSBindingSource.EndEdit() TBPM_PROFILE_CONTROLSTableAdapter.Update(DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS) End If If CURRENT_CONTROL_ID <> 0 Then Dim sql = "SELECT T.CONNECTION_ID,T1.BEZEICHNUNG AS 'CON_STRING',ISNULL(T.SQL_UEBERPRUEFUNG,'') AS 'SQL_COMMAND' FROM TBPM_PROFILE_CONTROLS T, TBPM_CONNECTION T1 WHERE " & "T.CONNECTION_ID = T1.GUID AND T.GUID = " & CURRENT_CONTROL_ID CURRENT_DT_SQL_CONFIG_TABLE = ClassDatabase.Return_Datatable(sql, True) CURRENT_INDEX_ID = CURRENT_CONTROL_ID CURRENT_DESIGN_TYPE = "INPUT_INDEX" CURRENT_SQL_COMAMND = SQL_CommandTextBox.Text CURRENT_SQL_CON = CONID frmSQL_DESIGNER.ShowDialog() Load_Control(CURRENT_CONTROL_ID) TabControlEigenschaften.SelectedIndex = 2 End If End Sub End Class