jj: add initial propertygrid functions
This commit is contained in:
parent
1e0bccdb48
commit
82376122c8
@ -180,6 +180,8 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="EntityDesigner\ClassControlBuilder.vb" />
|
<Compile Include="EntityDesigner\ClassControlBuilder.vb" />
|
||||||
<Compile Include="EntityDesigner\ClassControlUtils.vb" />
|
<Compile Include="EntityDesigner\ClassControlUtils.vb" />
|
||||||
|
<Compile Include="EntityDesigner\ControlProperties\ClassBaseProperties.vb" />
|
||||||
|
<Compile Include="EntityDesigner\ControlProperties\ClassLabelProperties.vb" />
|
||||||
<Compile Include="EntityDesigner\frmEntityDesigner.Designer.vb">
|
<Compile Include="EntityDesigner\frmEntityDesigner.Designer.vb">
|
||||||
<DependentUpon>frmEntityDesigner.vb</DependentUpon>
|
<DependentUpon>frmEntityDesigner.vb</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
Public Class ClassControlBuilder
|
Imports EDMI_ClientSuite.ClassControlUtils
|
||||||
|
|
||||||
|
Public Class ClassControlBuilder
|
||||||
#Region "State"
|
#Region "State"
|
||||||
Private _DesignMode As Boolean
|
Private _DesignMode As Boolean
|
||||||
#End Region
|
#End Region
|
||||||
@ -18,8 +20,9 @@
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function CreateLabel() As Label
|
Public Function CreateLabel() As Label
|
||||||
Dim Metadata As New ClassControlUtils.ControlMetadata() With {
|
Dim Metadata As New ControlMetadata() With {
|
||||||
.Id = 4711
|
.Id = 4711,
|
||||||
|
.Type = ControlType.Label
|
||||||
}
|
}
|
||||||
|
|
||||||
Dim oLabel As New Label() With {
|
Dim oLabel As New Label() With {
|
||||||
@ -34,8 +37,9 @@
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function CreateTextbox() As TextBox
|
Public Function CreateTextbox() As TextBox
|
||||||
Dim Metadata As New ClassControlUtils.ControlMetadata() With {
|
Dim Metadata As New ControlMetadata() With {
|
||||||
.Id = 4711
|
.Id = 4711,
|
||||||
|
.Type = ControlType.TextBox
|
||||||
}
|
}
|
||||||
|
|
||||||
Dim oTextbox As New TextBox() With {
|
Dim oTextbox As New TextBox() With {
|
||||||
|
|||||||
@ -6,5 +6,6 @@
|
|||||||
|
|
||||||
Public Class ControlMetadata
|
Public Class ControlMetadata
|
||||||
Public Id As Integer
|
Public Id As Integer
|
||||||
|
Public Type As ControlType
|
||||||
End Class
|
End Class
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@ -0,0 +1,10 @@
|
|||||||
|
Namespace ControlProperties
|
||||||
|
Public MustInherit Class ClassBaseProperties
|
||||||
|
|
||||||
|
Public Property Id As Integer
|
||||||
|
Public Property Type As String
|
||||||
|
Public Property Name As String
|
||||||
|
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
|
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
Namespace ControlProperties
|
||||||
|
Public Class ClassLabelProperties
|
||||||
|
Inherits ClassBaseProperties
|
||||||
|
End Class
|
||||||
|
|
||||||
|
End Namespace
|
||||||
|
|
||||||
@ -24,18 +24,18 @@ Partial Class frmEntityDesigner
|
|||||||
Private Sub InitializeComponent()
|
Private Sub InitializeComponent()
|
||||||
Me.SplitContainerMain = New DevExpress.XtraEditors.SplitContainerControl()
|
Me.SplitContainerMain = New DevExpress.XtraEditors.SplitContainerControl()
|
||||||
Me.PanelMain = New EDMI_ClientSuite.SnapPanel()
|
Me.PanelMain = New EDMI_ClientSuite.SnapPanel()
|
||||||
Me.TabControlDetail = New DevExpress.XtraTab.XtraTabControl()
|
Me.TabControlMain = New DevExpress.XtraTab.XtraTabControl()
|
||||||
Me.TabPageProperties = New DevExpress.XtraTab.XtraTabPage()
|
Me.TabPageProperties = New DevExpress.XtraTab.XtraTabPage()
|
||||||
Me.PropertyGridControl1 = New DevExpress.XtraVerticalGrid.PropertyGridControl()
|
Me.PropertyGridMain = New DevExpress.XtraVerticalGrid.PropertyGridControl()
|
||||||
Me.TabPageControls = New DevExpress.XtraTab.XtraTabPage()
|
Me.TabPageControls = New DevExpress.XtraTab.XtraTabPage()
|
||||||
Me.btnTextbox = New System.Windows.Forms.Button()
|
Me.btnTextbox = New System.Windows.Forms.Button()
|
||||||
Me.btnLabel = New System.Windows.Forms.Button()
|
Me.btnLabel = New System.Windows.Forms.Button()
|
||||||
CType(Me.SplitContainerMain, System.ComponentModel.ISupportInitialize).BeginInit()
|
CType(Me.SplitContainerMain, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
Me.SplitContainerMain.SuspendLayout()
|
Me.SplitContainerMain.SuspendLayout()
|
||||||
CType(Me.TabControlDetail, System.ComponentModel.ISupportInitialize).BeginInit()
|
CType(Me.TabControlMain, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
Me.TabControlDetail.SuspendLayout()
|
Me.TabControlMain.SuspendLayout()
|
||||||
Me.TabPageProperties.SuspendLayout()
|
Me.TabPageProperties.SuspendLayout()
|
||||||
CType(Me.PropertyGridControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
CType(Me.PropertyGridMain, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||||
Me.TabPageControls.SuspendLayout()
|
Me.TabPageControls.SuspendLayout()
|
||||||
Me.SuspendLayout()
|
Me.SuspendLayout()
|
||||||
'
|
'
|
||||||
@ -46,10 +46,10 @@ Partial Class frmEntityDesigner
|
|||||||
Me.SplitContainerMain.Name = "SplitContainerMain"
|
Me.SplitContainerMain.Name = "SplitContainerMain"
|
||||||
Me.SplitContainerMain.Panel1.Controls.Add(Me.PanelMain)
|
Me.SplitContainerMain.Panel1.Controls.Add(Me.PanelMain)
|
||||||
Me.SplitContainerMain.Panel1.Text = "Panel1"
|
Me.SplitContainerMain.Panel1.Text = "Panel1"
|
||||||
Me.SplitContainerMain.Panel2.Controls.Add(Me.TabControlDetail)
|
Me.SplitContainerMain.Panel2.Controls.Add(Me.TabControlMain)
|
||||||
Me.SplitContainerMain.Panel2.Text = "Panel2"
|
Me.SplitContainerMain.Panel2.Text = "Panel2"
|
||||||
Me.SplitContainerMain.Size = New System.Drawing.Size(800, 450)
|
Me.SplitContainerMain.Size = New System.Drawing.Size(800, 450)
|
||||||
Me.SplitContainerMain.SplitterPosition = 583
|
Me.SplitContainerMain.SplitterPosition = 571
|
||||||
Me.SplitContainerMain.TabIndex = 0
|
Me.SplitContainerMain.TabIndex = 0
|
||||||
Me.SplitContainerMain.Text = "SplitContainerControl1"
|
Me.SplitContainerMain.Text = "SplitContainerControl1"
|
||||||
'
|
'
|
||||||
@ -61,41 +61,41 @@ Partial Class frmEntityDesigner
|
|||||||
Me.PanelMain.Location = New System.Drawing.Point(0, 0)
|
Me.PanelMain.Location = New System.Drawing.Point(0, 0)
|
||||||
Me.PanelMain.Name = "PanelMain"
|
Me.PanelMain.Name = "PanelMain"
|
||||||
Me.PanelMain.ShowGrid = True
|
Me.PanelMain.ShowGrid = True
|
||||||
Me.PanelMain.Size = New System.Drawing.Size(583, 450)
|
Me.PanelMain.Size = New System.Drawing.Size(571, 450)
|
||||||
Me.PanelMain.TabIndex = 0
|
Me.PanelMain.TabIndex = 0
|
||||||
'
|
'
|
||||||
'TabControlDetail
|
'TabControlMain
|
||||||
'
|
'
|
||||||
Me.TabControlDetail.Dock = System.Windows.Forms.DockStyle.Fill
|
Me.TabControlMain.Dock = System.Windows.Forms.DockStyle.Fill
|
||||||
Me.TabControlDetail.Location = New System.Drawing.Point(0, 0)
|
Me.TabControlMain.Location = New System.Drawing.Point(0, 0)
|
||||||
Me.TabControlDetail.Name = "TabControlDetail"
|
Me.TabControlMain.Name = "TabControlMain"
|
||||||
Me.TabControlDetail.SelectedTabPage = Me.TabPageProperties
|
Me.TabControlMain.SelectedTabPage = Me.TabPageControls
|
||||||
Me.TabControlDetail.Size = New System.Drawing.Size(205, 450)
|
Me.TabControlMain.Size = New System.Drawing.Size(217, 450)
|
||||||
Me.TabControlDetail.TabIndex = 1
|
Me.TabControlMain.TabIndex = 0
|
||||||
Me.TabControlDetail.TabPages.AddRange(New DevExpress.XtraTab.XtraTabPage() {Me.TabPageControls, Me.TabPageProperties})
|
Me.TabControlMain.TabPages.AddRange(New DevExpress.XtraTab.XtraTabPage() {Me.TabPageControls, Me.TabPageProperties})
|
||||||
'
|
'
|
||||||
'TabPageProperties
|
'TabPageProperties
|
||||||
'
|
'
|
||||||
Me.TabPageProperties.Controls.Add(Me.PropertyGridControl1)
|
Me.TabPageProperties.Controls.Add(Me.PropertyGridMain)
|
||||||
Me.TabPageProperties.Name = "TabPageProperties"
|
Me.TabPageProperties.Name = "TabPageProperties"
|
||||||
Me.TabPageProperties.Size = New System.Drawing.Size(203, 425)
|
Me.TabPageProperties.Size = New System.Drawing.Size(215, 425)
|
||||||
Me.TabPageProperties.Text = "Properties"
|
Me.TabPageProperties.Text = "Properties"
|
||||||
'
|
'
|
||||||
'PropertyGridControl1
|
'PropertyGridMain
|
||||||
'
|
'
|
||||||
Me.PropertyGridControl1.Cursor = System.Windows.Forms.Cursors.Hand
|
Me.PropertyGridMain.Cursor = System.Windows.Forms.Cursors.Hand
|
||||||
Me.PropertyGridControl1.Dock = System.Windows.Forms.DockStyle.Fill
|
Me.PropertyGridMain.Dock = System.Windows.Forms.DockStyle.Fill
|
||||||
Me.PropertyGridControl1.Location = New System.Drawing.Point(0, 0)
|
Me.PropertyGridMain.Location = New System.Drawing.Point(0, 0)
|
||||||
Me.PropertyGridControl1.Name = "PropertyGridControl1"
|
Me.PropertyGridMain.Name = "PropertyGridMain"
|
||||||
Me.PropertyGridControl1.Size = New System.Drawing.Size(203, 425)
|
Me.PropertyGridMain.Size = New System.Drawing.Size(215, 425)
|
||||||
Me.PropertyGridControl1.TabIndex = 0
|
Me.PropertyGridMain.TabIndex = 0
|
||||||
'
|
'
|
||||||
'TabPageControls
|
'TabPageControls
|
||||||
'
|
'
|
||||||
Me.TabPageControls.Controls.Add(Me.btnTextbox)
|
Me.TabPageControls.Controls.Add(Me.btnTextbox)
|
||||||
Me.TabPageControls.Controls.Add(Me.btnLabel)
|
Me.TabPageControls.Controls.Add(Me.btnLabel)
|
||||||
Me.TabPageControls.Name = "TabPageControls"
|
Me.TabPageControls.Name = "TabPageControls"
|
||||||
Me.TabPageControls.Size = New System.Drawing.Size(262, 425)
|
Me.TabPageControls.Size = New System.Drawing.Size(215, 425)
|
||||||
Me.TabPageControls.Text = "Controls"
|
Me.TabPageControls.Text = "Controls"
|
||||||
'
|
'
|
||||||
'btnTextbox
|
'btnTextbox
|
||||||
@ -126,19 +126,19 @@ Partial Class frmEntityDesigner
|
|||||||
Me.Text = "Entitäten Designer"
|
Me.Text = "Entitäten Designer"
|
||||||
CType(Me.SplitContainerMain, System.ComponentModel.ISupportInitialize).EndInit()
|
CType(Me.SplitContainerMain, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
Me.SplitContainerMain.ResumeLayout(False)
|
Me.SplitContainerMain.ResumeLayout(False)
|
||||||
CType(Me.TabControlDetail, System.ComponentModel.ISupportInitialize).EndInit()
|
CType(Me.TabControlMain, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
Me.TabControlDetail.ResumeLayout(False)
|
Me.TabControlMain.ResumeLayout(False)
|
||||||
Me.TabPageProperties.ResumeLayout(False)
|
Me.TabPageProperties.ResumeLayout(False)
|
||||||
CType(Me.PropertyGridControl1, System.ComponentModel.ISupportInitialize).EndInit()
|
CType(Me.PropertyGridMain, System.ComponentModel.ISupportInitialize).EndInit()
|
||||||
Me.TabPageControls.ResumeLayout(False)
|
Me.TabPageControls.ResumeLayout(False)
|
||||||
Me.ResumeLayout(False)
|
Me.ResumeLayout(False)
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Friend WithEvents SplitContainerMain As DevExpress.XtraEditors.SplitContainerControl
|
Friend WithEvents SplitContainerMain As DevExpress.XtraEditors.SplitContainerControl
|
||||||
Friend WithEvents TabControlDetail As DevExpress.XtraTab.XtraTabControl
|
Friend WithEvents TabControlMain As DevExpress.XtraTab.XtraTabControl
|
||||||
Friend WithEvents TabPageProperties As DevExpress.XtraTab.XtraTabPage
|
Friend WithEvents TabPageProperties As DevExpress.XtraTab.XtraTabPage
|
||||||
Friend WithEvents PropertyGridControl1 As DevExpress.XtraVerticalGrid.PropertyGridControl
|
Friend WithEvents PropertyGridMain As DevExpress.XtraVerticalGrid.PropertyGridControl
|
||||||
Friend WithEvents TabPageControls As DevExpress.XtraTab.XtraTabPage
|
Friend WithEvents TabPageControls As DevExpress.XtraTab.XtraTabPage
|
||||||
Friend WithEvents PanelMain As SnapPanel
|
Friend WithEvents PanelMain As SnapPanel
|
||||||
Friend WithEvents btnTextbox As Button
|
Friend WithEvents btnTextbox As Button
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
|
Imports EDMI_ClientSuite.ClassControlUtils
|
||||||
|
Imports EDMI_ClientSuite.ControlProperties
|
||||||
|
|
||||||
Public Class frmEntityDesigner
|
Public Class frmEntityDesigner
|
||||||
Private _IsMouseDown As Boolean = False
|
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
|
Private Sub frmEntityDesigner_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||||
' Assign Control Types to DragDrop Buttons
|
' Assign Control Types to DragDrop Buttons
|
||||||
btnLabel.Tag = ClassControlUtils.ControlType.Label
|
btnLabel.Tag = ControlType.Label
|
||||||
btnTextbox.Tag = ClassControlUtils.ControlType.TextBox
|
btnTextbox.Tag = ControlType.TextBox
|
||||||
|
|
||||||
|
|
||||||
_ControlBuilder = New ClassControlBuilder(DesignMode:=True)
|
_ControlBuilder = New ClassControlBuilder(DesignMode:=True)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
#Region "Control Buttons Events"
|
#Region "Control Buttons Events"
|
||||||
Private Sub btnControl_MouseDown(sender As Object, e As MouseEventArgs) Handles btnLabel.MouseDown, btnTextbox.MouseDown
|
Private Sub btnControl_MouseDown(sender As Object, e As MouseEventArgs) Handles btnLabel.MouseDown, btnTextbox.MouseDown
|
||||||
_IsMouseDown = True
|
_IsMouseDown = True
|
||||||
@ -63,14 +63,13 @@ Public Class frmEntityDesigner
|
|||||||
End If
|
End If
|
||||||
End Sub
|
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
|
If _CurrentControl Is Nothing Or Not _IsMouseMoving Then
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Cursor = Cursors.Hand
|
Cursor = Cursors.Hand
|
||||||
|
|
||||||
Dim oControl = sender
|
|
||||||
Dim oCursorPosition As Point = PanelMain.PointToClient(Cursor.Position)
|
Dim oCursorPosition As Point = PanelMain.PointToClient(Cursor.Position)
|
||||||
Dim oNewPosition As New Point(oCursorPosition.X - _BeginPosition.X, oCursorPosition.Y - _BeginPosition.Y)
|
Dim oNewPosition As New Point(oCursorPosition.X - _BeginPosition.X, oCursorPosition.Y - _BeginPosition.Y)
|
||||||
|
|
||||||
@ -79,7 +78,7 @@ Public Class frmEntityDesigner
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
oControl.Location = oNewPosition
|
_CurrentControl.Location = oNewPosition
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub Control_MouseUp(sender As Object, e As MouseEventArgs)
|
Private Sub Control_MouseUp(sender As Object, e As MouseEventArgs)
|
||||||
@ -93,21 +92,45 @@ Public Class frmEntityDesigner
|
|||||||
Cursor = Cursors.Default
|
Cursor = Cursors.Default
|
||||||
End Sub
|
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)
|
Private Sub SetEventHandlers(Control As Control)
|
||||||
AddHandler Control.MouseDown, AddressOf Control_MouseDown
|
AddHandler Control.MouseDown, AddressOf Control_MouseDown
|
||||||
AddHandler Control.MouseMove, AddressOf Control_MouseMove
|
AddHandler Control.MouseMove, AddressOf Control_MouseMove
|
||||||
AddHandler Control.MouseUp, AddressOf Control_MouseUp
|
AddHandler Control.MouseUp, AddressOf Control_MouseUp
|
||||||
|
AddHandler Control.MouseClick, AddressOf Control_MouseClick
|
||||||
End Sub
|
End Sub
|
||||||
#End Region
|
#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 oCursorPosition As Point = PanelMain.PointToClient(Cursor.Position)
|
||||||
Dim oControl As Control = Nothing
|
Dim oControl As Control = Nothing
|
||||||
|
|
||||||
Select Case type
|
Select Case type
|
||||||
Case ClassControlUtils.ControlType.Label
|
Case ControlType.Label
|
||||||
oControl = _ControlBuilder.CreateLabel()
|
oControl = _ControlBuilder.CreateLabel()
|
||||||
Case ClassControlUtils.ControlType.TextBox
|
Case ControlType.TextBox
|
||||||
oControl = _ControlBuilder.CreateTextbox()
|
oControl = _ControlBuilder.CreateTextbox()
|
||||||
Case Else
|
Case Else
|
||||||
MsgBox($"Unknown Control Type {type.ToString}")
|
MsgBox($"Unknown Control Type {type.ToString}")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user