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

@ -0,0 +1,40 @@
Public Class ClassControl
Private props As BaseProperties
Private ctrl As Control
Public Sub New(control As Control)
ctrl = control
If TypeOf control Is Label Then
props = CreateBasePropertyObject(New LabelProperties())
ElseIf TypeOf control Is TextBox Then
props = CreateBasePropertyObject(New TextboxProperties())
End If
End Sub
Public ReadOnly Property Control As Control
Get
Return ctrl
End Get
End Property
Public Property Properties As BaseProperties
Get
Return props
End Get
Set(value As BaseProperties)
props = value
End Set
End Property
Private Function CreateBasePropertyObject(obj As BaseProperties) As BaseProperties
obj.ID = ctrl.Tag
obj.Name = ctrl.Name
obj.Location = ctrl.Location
obj.Width = ctrl.Width
obj.Height = ctrl.Height
Return obj
End Function
End Class

View File

@ -0,0 +1,52 @@
Public Class ClassControls
Private controls As List(Of ClassControl)
Public Sub New()
controls = New List(Of ClassControl)
End Sub
Public Sub Load(datatable As DataTable)
For Each row As DataRow In datatable.Rows
Dim type As String = row.Item("CTRL_TYPE")
Dim guid As Integer = row.Item("GUID")
Dim name As String = row.Item("NAME")
Dim location As New Point(row.Item("X_LOC"), row.Item("Y_LOC"))
Dim width As Integer = row.Item("WIDTH")
Dim height As Integer = row.Item("HEIGHT")
Dim text As String = row.Item("CTRL_TEXT")
Dim control As ClassControl
Select Case type
Case "TXT"
Dim textbox = AddTextbox(guid, name, height, width, location)
control = New ClassControl(textbox)
End Select
Next
End Sub
Public Function GetAll() As List(Of ClassControl)
Return controls
End Function
Public Function GetById() As ClassControl
End Function
Private Function AddTextbox(id As Integer, name As String, height As Integer, width As Integer, location As Point)
Dim textbox As New TextBox()
textbox.Tag = id
textbox.Name = name
textbox.Height = height
textbox.Width = width
textbox.Location = location
End Function
End Class

View File

@ -27,6 +27,7 @@
<DocumentationFile>DD_PM_WINDREAM.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
<CodeAnalysisRuleSet>UnusedCode.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
@ -149,6 +150,8 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ClassAnnotation.vb" />
<Compile Include="ClassControl.vb" />
<Compile Include="ClassControls.vb" />
<Compile Include="ClassInit.vb" />
<Compile Include="ClassLogger.vb" />
<Compile Include="frmAbout.designer.vb">
@ -269,6 +272,7 @@
<Compile Include="frmValidator.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="ModuleControlProperties.vb" />
<Compile Include="ModuleMySettings.vb" />
<Compile Include="ModuleRuntimeVariables.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />

View File

@ -0,0 +1,113 @@
Imports System.ComponentModel
Public Module ModuleControlProperties
Private _id As Integer
Private _name As String
Private _location As Point
Private _width As Integer
Private _height As Integer
Public Class BaseProperties
<ReadOnlyAttribute(True)>
Public Property ID() As Integer
Get
Return _id
End Get
Set(value As Integer)
_id = value
End Set
End Property
Public Property Name() As String
Get
Return _name
End Get
Set(value As String)
_name = value
End Set
End Property
Public Property Location() As Point
Get
Return _location
End Get
Set(value As Point)
_location = value
End Set
End Property
Public Property Width() As Integer
Get
Return _width
End Get
Set(value As Integer)
_width = value
End Set
End Property
Public Property Height() As Integer
Get
Return _height
End Get
Set(value As Integer)
_height = value
End Set
End Property
End Class
Public Class TextboxProperties
Inherits BaseProperties
Private _required As Boolean
Private _read_only As Boolean
Public Property Required() As String
Get
Return _required
End Get
Set(ByVal value As String)
_required = value
End Set
End Property
Public Property [ReadOnly]() As String
Get
Return _read_only
End Get
Set(ByVal value As String)
_read_only = value
End Set
End Property
End Class
Public Class LabelProperties
Inherits BaseProperties
Private _text As String
Public Property Text() As String
Get
Return _text
End Get
Set(value As String)
_text = value
End Set
End Property
End Class
Public Class CheckboxProperties
Inherits BaseProperties
Private _text As String
Public Property Text() As String
Get
Return _text
End Get
Set(value As String)
_text = value
End Set
End Property
End Class
End Module

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="New Rule Set" Description=" " ToolsVersion="15.0">
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1801" Action="Warning" />
<Rule Id="CA1804" Action="Warning" />
<Rule Id="CA1811" Action="Warning" />
<Rule Id="CA1812" Action="Warning" />
<Rule Id="CA1823" Action="Warning" />
</Rules>
<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
<Rule Id="C6259" Action="Warning" />
</Rules>
</RuleSet>

View File

@ -81,6 +81,8 @@ Partial Class frmFormDesigner
Me.Label4 = New System.Windows.Forms.Label()
Me.cmbConnection = New System.Windows.Forms.ComboBox()
Me.TBPM_CONNECTIONBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.TabPage4 = New System.Windows.Forms.TabPage()
Me.pgControls = New System.Windows.Forms.PropertyGrid()
Me.btndelete = New System.Windows.Forms.Button()
Me.btnsave = New System.Windows.Forms.Button()
Me.X_LOCTextBox = New System.Windows.Forms.TextBox()
@ -120,6 +122,7 @@ Partial Class frmFormDesigner
Me.TabPage3.SuspendLayout()
Me.pnlAuswahlliste.SuspendLayout()
CType(Me.TBPM_CONNECTIONBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
Me.TabPage4.SuspendLayout()
Me.StatusStrip1.SuspendLayout()
CType(Me.TBWH_CHECK_PROFILE_CONTROLSBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.TBPM_CONTROL_TABLEBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
@ -384,6 +387,7 @@ Partial Class frmFormDesigner
Me.TabControlEigenschaften.Controls.Add(Me.TabPage1)
Me.TabControlEigenschaften.Controls.Add(Me.TabPage2)
Me.TabControlEigenschaften.Controls.Add(Me.TabPage3)
Me.TabControlEigenschaften.Controls.Add(Me.TabPage4)
Me.TabControlEigenschaften.Location = New System.Drawing.Point(12, 22)
Me.TabControlEigenschaften.Name = "TabControlEigenschaften"
Me.TabControlEigenschaften.SelectedIndex = 0
@ -791,6 +795,26 @@ Partial Class frmFormDesigner
Me.TBPM_CONNECTIONBindingSource.DataMember = "TBPM_CONNECTION"
Me.TBPM_CONNECTIONBindingSource.DataSource = Me.DD_DMSLiteDataSet
'
'TabPage4
'
Me.TabPage4.Controls.Add(Me.pgControls)
Me.TabPage4.Location = New System.Drawing.Point(4, 25)
Me.TabPage4.Name = "TabPage4"
Me.TabPage4.Padding = New System.Windows.Forms.Padding(3)
Me.TabPage4.Size = New System.Drawing.Size(447, 234)
Me.TabPage4.TabIndex = 3
Me.TabPage4.Text = "TabPage4"
Me.TabPage4.UseVisualStyleBackColor = True
'
'pgControls
'
Me.pgControls.Dock = System.Windows.Forms.DockStyle.Fill
Me.pgControls.HelpVisible = False
Me.pgControls.Location = New System.Drawing.Point(3, 3)
Me.pgControls.Name = "pgControls"
Me.pgControls.Size = New System.Drawing.Size(441, 228)
Me.pgControls.TabIndex = 0
'
'btndelete
'
Me.btndelete.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
@ -1005,6 +1029,7 @@ Partial Class frmFormDesigner
Me.pnlAuswahlliste.ResumeLayout(False)
Me.pnlAuswahlliste.PerformLayout()
CType(Me.TBPM_CONNECTIONBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
Me.TabPage4.ResumeLayout(False)
Me.StatusStrip1.ResumeLayout(False)
Me.StatusStrip1.PerformLayout()
CType(Me.TBWH_CHECK_PROFILE_CONTROLSBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
@ -1083,4 +1108,6 @@ Partial Class frmFormDesigner
Friend WithEvents btnShowConnections As System.Windows.Forms.Button
Friend WithEvents btnEditor As Button
Friend WithEvents GUIDTextBox As TextBox
Friend WithEvents TabPage4 As TabPage
Friend WithEvents pgControls As PropertyGrid
End Class

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,7 +187,7 @@
End Sub
Sub Controls_laden()
Try
Me.TBPM_PROFILE_CONTROLSTableAdapter.FillByProfil(Me.DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS, CURRENT_ProfilGUID)
TBPM_PROFILE_CONTROLSTableAdapter.FillByProfil(DD_DMSLiteDataSet.TBPM_PROFILE_CONTROLS, CURRENT_ProfilGUID)
' löscht alle Controls
pnldesigner.Controls.Clear()
@ -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")
' 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
''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
' 'Check which mode we're in. If we're supposed to be moving
' '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
' 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()
' '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
' 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, "Movabledgv_MouseMove")
' 'm_Moving = False
' ' MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Movablecmb_MouseMove")
' MouseMoving = 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