BAUSTELLE: jj / formDesigner

This commit is contained in:
Jonathan Jenne
2018-03-01 15:47:25 +01:00
parent fa3d81d448
commit 55c7a7210b
7 changed files with 615 additions and 301 deletions

View File

@@ -1,15 +1,7 @@
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
@@ -20,6 +12,10 @@
Dim frmTableColumn As New frmControl_Detail
Private CURRENT_CONTROL As Control
' Movement Variables
Private MouseMoving As Boolean
Private BeginLocation As Point
Private EndLocation As Point
Private Sub frmFormDesigner_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
'
@@ -53,7 +49,6 @@
Private Sub frmFormDesigner_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Try
Me.lblDesign.Text = "FormDesigner für Profil: " & CURRENT_ProfilName
@@ -71,8 +66,8 @@
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)
TBPM_CONTROL_TABLETableAdapter.Connection.ConnectionString = MyConnectionString
TBPM_CONNECTIONTableAdapter.Fill(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
@@ -84,15 +79,15 @@
End Try
End Sub
Sub Load_indexe()
Me.cmbIndex.Items.Clear()
cmbIndex.Items.Clear()
Dim indexe = _windreamPM.GetIndicesByObjecttype(CURRENT_OBJECTTYPE)
If indexe IsNot Nothing Then
Me.cmbIndex.Items.Add("")
cmbIndex.Items.Add("")
For Each index As String In indexe
Me.cmbIndex.Items.Add(index)
cmbIndex.Items.Add(index)
Next
Me.cmbIndex.Items.Add("DD PM-ONLY FOR DISPLAY")
Me.cmbIndex.SelectedIndex = -1
cmbIndex.Items.Add("DD PM-ONLY FOR DISPLAY")
cmbIndex.SelectedIndex = -1
End If
End Sub
Sub Load_Indexe_Vektor()
@@ -192,8 +187,8 @@
End Sub
Sub Controls_laden()
Try
Me.TBPM_PROFILE_CONTROLSTableAdapter.FillByProfil(Me.DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS, CURRENT_ProfilGUID)
'löscht alle Controls
TBPM_PROFILE_CONTROLSTableAdapter.FillByProfil(DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS, CURRENT_ProfilGUID)
' löscht alle Controls
pnldesigner.Controls.Clear()
Dim dt As DataTable = DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS
@@ -256,7 +251,7 @@
Select Case e.Data.GetData(DataFormats.Text)
Case "lbl"
'idxlbl += 1
add_newlabel("lbl" & random.ToString)
AddNewLabel("lbl" & random.ToString)
Case "txt"
'idxtxt += 1
add_newtextbox("txt" & random)
@@ -296,7 +291,7 @@
Return 0
End Try
End Function
Function add_newlabel(lblname As String)
Function AddNewLabel(lblname As String)
Try
Dim lbl As New Label
lbl.Name = lblname
@@ -309,10 +304,12 @@
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
'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
SetMovementHandlers(lbl)
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()
@@ -331,12 +328,19 @@
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
'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
SetMovementHandlers(lbl)
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)
@@ -354,10 +358,12 @@
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
'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
SetMovementHandlers(txt)
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)
@@ -383,10 +389,15 @@
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
''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
SetMovementHandlers(txt)
btnsave.Visible = True
End Function
@@ -404,10 +415,12 @@
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
'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
SetMovementHandlers(chk)
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()
@@ -426,10 +439,12 @@
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
'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
SetMovementHandlers(chk)
btnsave.Visible = True
End Function
Function add_newCombobox(cmbname As String)
@@ -443,10 +458,12 @@
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
'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
SetMovementHandlers(cmb)
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()
@@ -463,10 +480,11 @@
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
'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
SetMovementHandlers(cmb)
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)
@@ -479,10 +497,11 @@
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
'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
SetMovementHandlers(dtp)
btnsave.Visible = True
End Function
Function add_newDTP(dtpname As String)
@@ -496,10 +515,12 @@
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
'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
SetMovementHandlers(dtp)
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()
@@ -528,10 +549,11 @@
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
'AddHandler dgv.Click, AddressOf OndgvClick
'AddHandler dgv.MouseDown, AddressOf MovableDGV_MouseDown
'AddHandler dgv.MouseUp, AddressOf MovableCtrl_MouseUp
'AddHandler dgv.MouseMove, AddressOf dgv_MouseMove
SetMovementHandlers(dgv)
btnsave.Visible = True
End Function
@@ -555,10 +577,12 @@
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
'AddHandler dgv.Click, AddressOf OndgvClick
'AddHandler dgv.MouseDown, AddressOf MovableDGV_MouseDown
'AddHandler dgv.MouseUp, AddressOf MovableCtrl_MouseUp
'AddHandler dgv.MouseMove, AddressOf dgv_MouseMove
SetMovementHandlers(dgv)
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()
@@ -590,10 +614,12 @@
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.Click, AddressOf OndgvClick
'AddHandler table.MouseDown, AddressOf MovableDGV_MouseDown
'AddHandler table.MouseUp, AddressOf MovableCtrl_MouseUp
'AddHandler table.MouseMove, AddressOf dgv_MouseMove
SetMovementHandlers(table)
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()
@@ -633,10 +659,12 @@
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.Click, AddressOf OndgvClick
'AddHandler table.MouseDown, AddressOf MovableDGV_MouseDown
'AddHandler table.MouseUp, AddressOf MovableCtrl_MouseUp
'AddHandler table.MouseMove, AddressOf dgv_MouseMove
SetMovementHandlers(table)
AddHandler table.ColumnHeaderMouseClick, AddressOf table_ColumnHeaderMouseClick
btnsave.Visible = True
@@ -906,11 +934,11 @@
Dim lbl As Label = DirectCast(sender, Label)
CURRENT_CONTROL = sender
begin_location = e.Location
BeginLocation = 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
MouseMoving = True
End If
End Sub
Private Sub MovableText_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
@@ -920,11 +948,11 @@
Dim txt As TextBox = DirectCast(sender, TextBox)
CURRENT_CONTROL = sender
begin_location = e.Location
BeginLocation = 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
MouseMoving = True
End If
End Sub
Private Sub MovableChk_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
@@ -933,11 +961,11 @@
Clear_control_Details()
Dim txt As CheckBox = DirectCast(sender, CheckBox)
CURRENT_CONTROL = sender
begin_location = e.Location
BeginLocation = 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
MouseMoving = True
End If
End Sub
Private Sub Movablecmb_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
@@ -946,12 +974,12 @@
Clear_control_Details()
Dim cmb As ComboBox = DirectCast(sender, ComboBox)
CURRENT_CONTROL = sender
begin_location = e.Location
BeginLocation = 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
MouseMoving = True
End If
End Sub
Private Sub Movabledtp_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
@@ -962,13 +990,13 @@
CURRENT_CONTROL = sender
'Console.WriteLine("X: " & cursor.X & ";Y=" & cursor.Y)
begin_location = e.Location
BeginLocation = 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
MouseMoving = True
'Jetzt Controleigenschaften laden
Load_Control()
@@ -989,12 +1017,12 @@
CURRENT_CONTROL = sender
begin_location = e.Location
BeginLocation = 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
MouseMoving = True
CURRENT_CONTROL = sender
@@ -1008,9 +1036,9 @@
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 MouseMoving = True Then
MouseMoving = False
EndLocation = 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
@@ -1026,242 +1054,174 @@
' 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()
'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 MouseMoving = 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
' 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, BeginLocation) Then
' CURRENT_CONTROL.Location = New System.Drawing.Point(NowCursor.X - BeginLocation.X,
' NowCursor.Y - BeginLocation.Y)
' End If
' End If
' Catch ex As Exception
' ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "MovableLabel_MouseMove")
' MouseMoving = 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()
'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 MouseMoving = 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 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
' 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, BeginLocation) Then
' lbl.Location = New System.Drawing.Point(NowCursor.X - BeginLocation.X,
' NowCursor.Y - BeginLocation.Y)
' End If
' End If
' Catch ex As Exception
' ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "MovableLabel_MouseMove")
' MouseMoving = 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
'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.DateTimePicker" Then
' If MouseMoving = 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 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)
' 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
' '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)
' If Point.op_Inequality(NowCursor, BeginLocation) Then
' txt.Location = New System.Drawing.Point(NowCursor.X - BeginLocation.X,
' NowCursor.Y - BeginLocation.Y)
' End If
' End If
' Catch ex As Exception
' ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "MovableText_MouseMove")
' MouseMoving = 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 MouseMoving = 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, BeginLocation) Then
' chk.Location = New System.Drawing.Point(NowCursor.X - BeginLocation.X,
' NowCursor.Y - BeginLocation.Y)
' End If
' End If
' Catch ex As Exception
' ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "MovableChk_MouseMove")
' MouseMoving = 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 MouseMoving = 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, BeginLocation) Then
' cmb.Location = New System.Drawing.Point(NowCursor.X - BeginLocation.X,
' NowCursor.Y - BeginLocation.Y)
' End If
' End If
' Catch ex As Exception
' ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Movablecmb_MouseMove")
' MouseMoving = False
' End Try
'End Sub
''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 MouseMoving = 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 - BeginLocation.X, clientPosition.Y - BeginLocation.Y)
' End If
' End If
' Catch ex As Exception
' ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Movablecmb_MouseMove")
' m_Moving = False
' MouseMoving = 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
@@ -1534,4 +1494,109 @@
End If
End Sub
#Region "Rewrite"
''' <summary>
''' Setzt die Eventhandler für ein Control, die für die Bewegung via Drag & Drop und das Laden der Eigentschaften verantwortlich sind
''' </summary>
''' <param name="control">Das Control, für das die Eventhandler gesetzt werden sollen</param>
Private Sub SetMovementHandlers(control As Control)
AddHandler control.Click, AddressOf OnControl_Click
AddHandler control.MouseDown, AddressOf OnControl_MouseDown
AddHandler control.MouseUp, AddressOf OnControl_MouseUp
AddHandler control.MouseMove, AddressOf OnControl_MouseMove
End Sub
''' <summary>
''' Weist die grundlegenden Eigenschaften zu einem Properties Objekt zu
''' Die Properties werden an das Property Grid weitergegeben
''' </summary>
''' <param name="obj">Das grundlegende Properties Objekt</param>
''' <param name="row">Die DataRow, die die Eigenschaften des Controls enthält</param>
''' <returns>Das gefüllt Properties Objekt</returns>
Private Function CreatePropsObject(obj As BaseProperties, row As DataRow)
obj.ID = row.Item("GUID")
obj.Location = New Point(row.Item("X_LOC"), row.Item("Y_LOC"))
obj.Name = row.Item("NAME")
obj.Width = row.Item("WIDTH")
obj.Height = row.Item("HEIGHT")
Return obj
End Function
Private Sub OnControl_MouseDown(sender As Control, e As MouseEventArgs)
If e.Button = MouseButtons.Left Then
CURRENT_CONTROL = sender
BeginLocation = e.Location
sender.BringToFront()
MouseMoving = True
End If
End Sub
Private Sub OnControl_MouseUp(sender As Control, e As MouseEventArgs)
If MouseMoving Then
MouseMoving = False
EndLocation = e.Location
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
MyBase.Cursor = Cursors.Default
End Sub
Private Sub OnControl_MouseMove(sender As Control, e As MouseEventArgs)
If CURRENT_CONTROL Is Nothing Then
Exit Sub
End If
If MouseMoving Then
Cursor = Cursors.Hand
Refresh()
Dim CurrentPosition As Point = GetCursorPosition()
If Point.op_Inequality(CurrentPosition, BeginLocation) Then
CURRENT_CONTROL.Location = New Point(CurrentPosition.X - BeginLocation.X, CurrentPosition.Y - BeginLocation.Y)
End If
End If
End Sub
Private Sub OnControl_Click(sender As Control, e As MouseEventArgs)
Dim props
Dim dt As DataTable = DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS
Dim row = dt.AsEnumerable().Where(Function(r As DataRow)
Return r.Item("GUID") = sender.Tag
End Function).Single()
CURRENT_CONTROL = sender
gbxControl.Visible = True
If TypeOf sender Is Label Then
Dim label As Label = sender
Dim labelProps As LabelProperties = CreatePropsObject(New LabelProperties, row)
labelProps.Text = label.Text
props = labelProps
ElseIf TypeOf sender Is CheckBox Then
Dim check As CheckBox = sender
Dim checkProps As CheckboxProperties = CreatePropsObject(New CheckboxProperties, row)
checkProps.Text = check.Text
props = checkProps
ElseIf TypeOf sender Is TextBox Then
Dim txt As TextBox = sender
Dim txtProps As TextboxProperties = CreatePropsObject(New TextboxProperties, row)
txtProps.ReadOnly = row.Item("READ_ONLY")
txtProps.Required = row.Item("VALIDATION")
props = txtProps
End If
pgControls.SelectedObject = props
End Sub
#End Region
End Class