jj: add initial propertygrid functions
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
|
||||
Imports EDMI_ClientSuite.ClassControlUtils
|
||||
Imports EDMI_ClientSuite.ControlProperties
|
||||
|
||||
Public Class frmEntityDesigner
|
||||
Private _IsMouseDown As Boolean = False
|
||||
@@ -13,14 +14,13 @@ Public Class frmEntityDesigner
|
||||
|
||||
Private Sub frmEntityDesigner_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
' Assign Control Types to DragDrop Buttons
|
||||
btnLabel.Tag = ClassControlUtils.ControlType.Label
|
||||
btnTextbox.Tag = ClassControlUtils.ControlType.TextBox
|
||||
btnLabel.Tag = ControlType.Label
|
||||
btnTextbox.Tag = ControlType.TextBox
|
||||
|
||||
|
||||
_ControlBuilder = New ClassControlBuilder(DesignMode:=True)
|
||||
End Sub
|
||||
|
||||
|
||||
#Region "Control Buttons Events"
|
||||
Private Sub btnControl_MouseDown(sender As Object, e As MouseEventArgs) Handles btnLabel.MouseDown, btnTextbox.MouseDown
|
||||
_IsMouseDown = True
|
||||
@@ -63,14 +63,13 @@ Public Class frmEntityDesigner
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Control_MouseMove(sender As Control, e As MouseEventArgs)
|
||||
Private Sub Control_MouseMove(sender As Object, e As MouseEventArgs)
|
||||
If _CurrentControl Is Nothing Or Not _IsMouseMoving Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Cursor = Cursors.Hand
|
||||
|
||||
Dim oControl = sender
|
||||
Dim oCursorPosition As Point = PanelMain.PointToClient(Cursor.Position)
|
||||
Dim oNewPosition As New Point(oCursorPosition.X - _BeginPosition.X, oCursorPosition.Y - _BeginPosition.Y)
|
||||
|
||||
@@ -79,7 +78,7 @@ Public Class frmEntityDesigner
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
oControl.Location = oNewPosition
|
||||
_CurrentControl.Location = oNewPosition
|
||||
End Sub
|
||||
|
||||
Private Sub Control_MouseUp(sender As Object, e As MouseEventArgs)
|
||||
@@ -93,21 +92,45 @@ Public Class frmEntityDesigner
|
||||
Cursor = Cursors.Default
|
||||
End Sub
|
||||
|
||||
Private Sub Control_MouseClick(sender As Control, e As MouseEventArgs)
|
||||
TabControlMain.SelectedTabPage = TabPageControls
|
||||
HandleLoadProperties(sender)
|
||||
End Sub
|
||||
|
||||
Private Sub SetEventHandlers(Control As Control)
|
||||
AddHandler Control.MouseDown, AddressOf Control_MouseDown
|
||||
AddHandler Control.MouseMove, AddressOf Control_MouseMove
|
||||
AddHandler Control.MouseUp, AddressOf Control_MouseUp
|
||||
AddHandler Control.MouseClick, AddressOf Control_MouseClick
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
Private Sub HandleDragDrop(type As ClassControlUtils.ControlType)
|
||||
Private Sub HandleLoadProperties(Control As Control)
|
||||
Dim oMetadata As ControlMetadata = Control.Tag
|
||||
Dim oType = oMetadata.Type
|
||||
Dim oProps As ClassBaseProperties = Nothing
|
||||
|
||||
Select Case oType
|
||||
Case ControlType.Label
|
||||
oProps = New ClassLabelProperties()
|
||||
oProps.Id = oMetadata.Id
|
||||
oProps.Name = Control.Name
|
||||
oProps.Type = oType
|
||||
Case Else
|
||||
Exit Sub
|
||||
End Select
|
||||
|
||||
PropertyGridMain.SelectedObject = oProps
|
||||
End Sub
|
||||
|
||||
Private Sub HandleDragDrop(type As ControlType)
|
||||
Dim oCursorPosition As Point = PanelMain.PointToClient(Cursor.Position)
|
||||
Dim oControl As Control = Nothing
|
||||
|
||||
Select Case type
|
||||
Case ClassControlUtils.ControlType.Label
|
||||
Case ControlType.Label
|
||||
oControl = _ControlBuilder.CreateLabel()
|
||||
Case ClassControlUtils.ControlType.TextBox
|
||||
Case ControlType.TextBox
|
||||
oControl = _ControlBuilder.CreateTextbox()
|
||||
Case Else
|
||||
MsgBox($"Unknown Control Type {type.ToString}")
|
||||
|
||||
Reference in New Issue
Block a user