jj
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
Imports EDMI_ClientSuite.ClassControlUtils
|
||||
Imports EDMI_ClientSuite.ControlProperties
|
||||
Imports DigitalData.GUIS.ClientSuite.ClassControlUtils
|
||||
Imports DigitalData.GUIS.ClientSuite.ControlProperties
|
||||
Imports DevExpress.XtraEditors.Repository
|
||||
Imports DevExpress.XtraVerticalGrid
|
||||
|
||||
Public Class frmEntityDesigner
|
||||
Private _IsMouseDown As Boolean = False
|
||||
@@ -12,24 +14,45 @@ Public Class frmEntityDesigner
|
||||
Private _CurrentControl As Control = Nothing
|
||||
Private _ControlBuilder As ClassControlBuilder = Nothing
|
||||
|
||||
Private _DragDropButtonList As New List(Of Button)
|
||||
|
||||
Private Sub frmEntityDesigner_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
' Assign Control Types to DragDrop Buttons
|
||||
btnLabel.Tag = ControlType.Label
|
||||
btnTextbox.Tag = ControlType.TextBox
|
||||
btnCombobox.Tag = ControlType.Combobox
|
||||
|
||||
' Add Default Editors for certain datatypes in the PropertyGrid
|
||||
Dim oColorEditor = New RepositoryItemColorEdit()
|
||||
Dim oBooleanEditor = New RepositoryItemCheckEdit()
|
||||
|
||||
PropertyGridMain.DefaultEditors.Add(GetType(Color), oColorEditor)
|
||||
PropertyGridMain.DefaultEditors.Add(GetType(Boolean), oBooleanEditor)
|
||||
|
||||
' Create the control builder
|
||||
_ControlBuilder = New ClassControlBuilder(DesignMode:=True)
|
||||
|
||||
' Create a list of all DragDrop buttons
|
||||
_DragDropButtonList.Add(btnLabel)
|
||||
_DragDropButtonList.Add(btnTextbox)
|
||||
_DragDropButtonList.Add(btnCombobox)
|
||||
|
||||
' Add EventHandlers for each button
|
||||
For Each oButton As Button In _DragDropButtonList
|
||||
AddHandler oButton.MouseDown, AddressOf DragDropButton_MouseDown
|
||||
AddHandler oButton.MouseMove, AddressOf DragDropButton_MouseMove
|
||||
Next
|
||||
End Sub
|
||||
|
||||
#Region "Control Buttons Events"
|
||||
Private Sub btnControl_MouseDown(sender As Object, e As MouseEventArgs) Handles btnLabel.MouseDown, btnTextbox.MouseDown
|
||||
Private Sub DragDropButton_MouseDown(sender As Object, e As MouseEventArgs)
|
||||
_IsMouseDown = True
|
||||
End Sub
|
||||
|
||||
Private Sub btnControl_MouseMove(sender As Button, e As MouseEventArgs) Handles btnLabel.MouseMove, btnTextbox.MouseMove
|
||||
Private Sub DragDropButton_MouseMove(sender As Button, e As MouseEventArgs)
|
||||
If _IsMouseDown Then
|
||||
Dim oButton = sender
|
||||
Dim oType As ClassControlUtils.ControlType = oButton.Tag
|
||||
Dim oType As ControlType = oButton.Tag
|
||||
|
||||
oButton.DoDragDrop(oType.ToString, DragDropEffects.Copy)
|
||||
End If
|
||||
@@ -93,15 +116,25 @@ Public Class frmEntityDesigner
|
||||
End Sub
|
||||
|
||||
Private Sub Control_MouseClick(sender As Control, e As MouseEventArgs)
|
||||
TabControlMain.SelectedTabPage = TabPageControls
|
||||
TabControlMain.SelectedTabPage = TabPageProperties
|
||||
HandleLoadProperties(sender)
|
||||
End Sub
|
||||
|
||||
Private Sub Control_MouseEnter(sender As Control, e As EventArgs)
|
||||
Cursor = Cursors.Hand
|
||||
End Sub
|
||||
|
||||
Private Sub Control_MouseLeave(sender As Control, e As EventArgs)
|
||||
Cursor = Cursors.Default
|
||||
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
|
||||
AddHandler Control.MouseEnter, AddressOf Control_MouseEnter
|
||||
AddHandler Control.MouseLeave, AddressOf Control_MouseLeave
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
@@ -112,10 +145,48 @@ Public Class frmEntityDesigner
|
||||
|
||||
Select Case oType
|
||||
Case ControlType.Label
|
||||
oProps = New ClassLabelProperties()
|
||||
oProps.Id = oMetadata.Id
|
||||
oProps.Name = Control.Name
|
||||
oProps.Type = oType
|
||||
oProps = New ClassLabelProperties With {
|
||||
.Id = oMetadata.Id,
|
||||
.Name = Control.Name,
|
||||
.Type = oType,
|
||||
.Location = Control.Location,
|
||||
.Size = Control.Size,
|
||||
.Font = Control.Font,
|
||||
.Color = Control.ForeColor,
|
||||
.Caption = Control.Text
|
||||
}
|
||||
Case ControlType.TextBox
|
||||
oProps = New ClassTextboxProperties With {
|
||||
.Id = oMetadata.Id,
|
||||
.Name = Control.Name,
|
||||
.Type = oType,
|
||||
.Location = Control.Location,
|
||||
.Size = Control.Size,
|
||||
.Font = Control.Font,
|
||||
.Color = ForeColor,
|
||||
.IsReadOnly = False,
|
||||
.IsRequired = False,
|
||||
.Multiline = False,
|
||||
.TabIndex = 0,
|
||||
.TabStop = 1,
|
||||
.DefaultValue = ""
|
||||
}
|
||||
Case ControlType.Combobox
|
||||
oProps = New ClassComboboxProperties() With {
|
||||
.Id = oMetadata.Id,
|
||||
.Name = Control.Name,
|
||||
.Type = oType,
|
||||
.Location = Control.Location,
|
||||
.Size = Control.Size,
|
||||
.Font = Control.Font,
|
||||
.Color = ForeColor,
|
||||
.IsReadOnly = False,
|
||||
.IsRequired = False,
|
||||
.TabIndex = 0,
|
||||
.TabStop = 1,
|
||||
.DefaultValue = "",
|
||||
.StaticList = New StaticList()
|
||||
}
|
||||
Case Else
|
||||
Exit Sub
|
||||
End Select
|
||||
@@ -132,6 +203,8 @@ Public Class frmEntityDesigner
|
||||
oControl = _ControlBuilder.CreateLabel()
|
||||
Case ControlType.TextBox
|
||||
oControl = _ControlBuilder.CreateTextbox()
|
||||
Case ControlType.Combobox
|
||||
oControl = _ControlBuilder.CreateCombobox()
|
||||
Case Else
|
||||
MsgBox($"Unknown Control Type {type.ToString}")
|
||||
Exit Sub
|
||||
@@ -147,5 +220,38 @@ Public Class frmEntityDesigner
|
||||
PanelMain.Controls.Add(oControl)
|
||||
End Sub
|
||||
|
||||
Private Sub PropertyGridMain_RowChanged(sender As Object, e As DevExpress.XtraVerticalGrid.Events.RowChangedEventArgs) Handles PropertyGridMain.RowChanged
|
||||
If e.ChangeType <> RowChangeTypeEnum.Value Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oPropertyName As String = e.Properties.FieldName
|
||||
Dim oPropertyValue = e.Properties.Value
|
||||
|
||||
|
||||
Select Case oPropertyName
|
||||
Case "Name"
|
||||
_CurrentControl.Name = oPropertyValue
|
||||
Case "Location"
|
||||
_CurrentControl.Location = oPropertyValue
|
||||
Case "X"
|
||||
_CurrentControl.Location = New Point(oPropertyValue, _CurrentControl.Location.Y)
|
||||
Case "Y"
|
||||
_CurrentControl.Location = New Point(_CurrentControl.Location.X, oPropertyValue)
|
||||
Case "Size"
|
||||
_CurrentControl.Size = oPropertyValue
|
||||
Case "Width"
|
||||
_CurrentControl.Size = New Size(oPropertyValue, _CurrentControl.Height)
|
||||
Case "Height"
|
||||
_CurrentControl.Size = New Size(_CurrentControl.Width, oPropertyValue)
|
||||
Case "Font"
|
||||
_CurrentControl.Font = oPropertyValue
|
||||
Case "Color"
|
||||
_CurrentControl.ForeColor = oPropertyValue
|
||||
Case "Caption"
|
||||
If TypeOf _CurrentControl Is Label Then
|
||||
_CurrentControl.Text = oPropertyValue
|
||||
End If
|
||||
End Select
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user