This commit is contained in:
Jonathan Jenne
2019-01-23 14:57:57 +01:00
parent 82376122c8
commit fcddb353c1
24 changed files with 1913 additions and 76 deletions

View File

@@ -1,4 +1,5 @@
Imports EDMI_ClientSuite.ClassControlUtils
Imports DigitalData.Controls.LookupGrid
Imports DigitalData.GUIS.ClientSuite.ClassControlUtils
Public Class ClassControlBuilder
#Region "State"
@@ -51,4 +52,19 @@ Public Class ClassControlBuilder
Return oTextbox
End Function
Public Function CreateCombobox() As LookupControl
Dim Metadata As New ControlMetadata() With {
.Id = 4711,
.Type = ControlType.Combobox
}
Dim oCombobox As New LookupControl() With {
.Name = GetRandomControlName("Combobox"),
.Size = DEFAULT_SIZE,
.Tag = Metadata
}
Return oCombobox
End Function
End Class

View File

@@ -0,0 +1,27 @@
Imports System.ComponentModel
Public Class ClassControlLocalization
Private Shared Function Lookup(key As String)
Try
Return My.Resources.ControlProperties.ResourceManager.GetString(key)
Catch ex As Exception
Return key
End Try
End Function
Public Class LocalizedDescriptionAttribute
Inherits DescriptionAttribute
Public Sub New(key As String)
MyBase.New(Lookup(key))
End Sub
End Class
Public Class LocalizedCategoryAttribute
Inherits CategoryAttribute
Public Sub New(key As String)
MyBase.New(Lookup(key))
End Sub
End Class
End Class

View File

@@ -2,10 +2,13 @@
Public Enum ControlType
Label = 0
TextBox = 1
Combobox = 2
End Enum
Public Class ControlMetadata
Public Id As Integer
Public Type As ControlType
End Class
End Class

View File

@@ -0,0 +1,40 @@
Imports System.ComponentModel
Imports DigitalData.GUIS.ClientSuite.ClassControlLocalization
Imports DigitalData.GUIS.ClientSuite.ClassControlUtils
Namespace ControlProperties
Public MustInherit Class ClassBaseProperties
<LocalizedCategory("category_info")>
<LocalizedDescription("desc_id")>
<[ReadOnly](True)>
Public Property Id As Integer
<LocalizedCategory("category_info")>
<LocalizedDescription("desc_type")>
<[ReadOnly](True)>
Public Property Type As ControlType
<LocalizedCategory("category_view")>
<LocalizedDescription("desc_name")>
Public Property Name As String
<LocalizedCategory("category_view")>
<LocalizedDescription("desc_location")>
Public Property Location As Point
<LocalizedCategory("category_view")>
<LocalizedDescription("desc_size")>
Public Property Size As Size
<LocalizedCategory("category_view")>
<LocalizedDescription("desc_fontstyle")>
Public Property Font() As Font
<LocalizedCategory("category_view")>
<LocalizedDescription("desc_color")>
Public Property Color() As Color
End Class
End Namespace

View File

@@ -0,0 +1,27 @@
Imports DigitalData.GUIS.ClientSuite.ClassControlLocalization
Namespace ControlProperties
Public MustInherit Class ClassInputProperties
Inherits ClassBaseProperties
<LocalizedCategory("category_input")>
<LocalizedDescription("desc_required")>
Public Property IsRequired() As Boolean
<LocalizedCategory("category_input")>
<LocalizedDescription("desc_readonly")>
Public Property IsReadOnly() As Boolean
<LocalizedCategory("category_input")>
<LocalizedDescription("desc_defaultvalue")>
Public Property DefaultValue() As String
<LocalizedCategory("category_other")>
<LocalizedDescription("desc_tabindex")>
Public Property TabIndex() As Integer
<LocalizedCategory("category_other")>
<LocalizedDescription("desc_tabstop")>
Public Property TabStop() As Boolean
End Class
End Namespace

View File

@@ -0,0 +1,27 @@
Imports System.ComponentModel
Imports System.Drawing.Design
Imports DevExpress.XtraEditors.Repository
Imports DigitalData.GUIS.ClientSuite.ClassControlLocalization
Namespace ControlProperties
Public Class ClassMultiInputProperties
Inherits ClassInputProperties
Private _static_list As String
<LocalizedDescription("desc_staticlist")>
<LocalizedCategory("category_data")>
Public Property StaticList As StaticList
Get
Return New StaticList(_static_list)
End Get
Set(value As StaticList)
_static_list = value?.Value
End Set
End Property
End Class
End Namespace

View File

@@ -1,10 +0,0 @@
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

View File

@@ -1,7 +0,0 @@
Namespace ControlProperties
Public Class ClassLabelProperties
Inherits ClassBaseProperties
End Class
End Namespace

View File

@@ -0,0 +1,7 @@
Namespace ControlProperties
Public Class ClassComboboxProperties
Inherits ClassMultiInputProperties
End Class
End Namespace

View File

@@ -0,0 +1,14 @@
Imports System.ComponentModel
Imports DigitalData.GUIS.ClientSuite.ClassControlLocalization
Namespace ControlProperties
Public Class ClassLabelProperties
Inherits ClassBaseProperties
<LocalizedCategory("category_view")>
<LocalizedDescription("desc_id")>
Public Property Caption As String
End Class
End Namespace

View File

@@ -0,0 +1,13 @@
Imports System.ComponentModel
Imports DigitalData.GUIS.ClientSuite.ClassControlLocalization
Namespace ControlProperties
Public Class ClassTextboxProperties
Inherits ClassInputProperties
<LocalizedCategory("category_view")>
<LocalizedDescription("desc_multiline")>
<DefaultValue(False)>
Public Property Multiline() As Boolean
End Class
End Namespace

View File

@@ -0,0 +1,72 @@
Imports System.ComponentModel
'Imports System.ComponentModel.Design
Imports System.Drawing.Design
'Imports System.Windows.Forms
Imports System.Windows.Forms.Design
Public Class ClassStaticListEditor
Inherits UITypeEditor
Public Overrides Function GetEditStyle(context As ITypeDescriptorContext) As UITypeEditorEditStyle
Return UITypeEditorEditStyle.Modal
End Function
Public Overrides Function EditValue(context As ITypeDescriptorContext, provider As IServiceProvider, value As Object) As Object
Dim oService As IWindowsFormsEditorService = TryCast(provider.GetService(GetType(IWindowsFormsEditorService)), IWindowsFormsEditorService)
Dim oStaticListString As String = DirectCast(value, StaticList).Value
If oService IsNot Nothing AndAlso oStaticListString IsNot Nothing Then
Using oForm As New frmStaticListEditor()
oStaticListString = oStaticListString.Replace(";", vbNewLine) ' Semikolon zu vbNewLine
oForm.Value = oStaticListString
If oService.ShowDialog(oForm) = DialogResult.OK Then
Dim oString As String = oForm.Value.Replace(vbNewLine, ";") ' vbNewLine zu Semikolon
Dim oStaticList As New StaticList(oString)
value = oStaticList
End If
End Using
End If
Return value
End Function
End Class
<Editor(GetType(ClassStaticListEditor), GetType(UITypeEditor))>
<TypeConverter(GetType(StaticListTypeConverter))>
Public Class StaticList
Public Sub New()
_Value = String.Empty
End Sub
Public Sub New(Value As String)
_Value = Value
End Sub
Public Property Value As String
End Class
Public Class StaticListTypeConverter
Inherits TypeConverter
Public Overrides Function ToString() As String
Return MyBase.ToString()
End Function
' Diese Funktion gibt den String zurück, der im PropertyGrid für den Benutzer sichtbar ist, kann ruhig etwas hübscher sein als foo;bar;baz
Public Overrides Function ConvertTo(context As ITypeDescriptorContext, culture As Globalization.CultureInfo, value As Object, destinationType As Type) As Object
Dim oStaticListString = String.Empty
If TypeOf value Is StaticList Then
Dim oStaticList As StaticList = DirectCast(value, StaticList)
oStaticListString = oStaticList.Value
ElseIf TypeOf value Is String Then
oStaticListString = value
Else
MsgBox("Error in Converting StaticList value")
End If
Return oStaticListString.Replace(";", ", ")
End Function
End Class

View File

@@ -0,0 +1,81 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmStaticListEditor
Inherits DevExpress.XtraEditors.XtraForm
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmStaticListEditor))
Me.txtValue = New System.Windows.Forms.TextBox()
Me.Button1 = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.Button2 = New System.Windows.Forms.Button()
Me.Label2 = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'txtValue
'
resources.ApplyResources(Me.txtValue, "txtValue")
Me.txtValue.Name = "txtValue"
'
'Button1
'
resources.ApplyResources(Me.Button1, "Button1")
Me.Button1.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Button1.Name = "Button1"
Me.Button1.UseVisualStyleBackColor = True
'
'Label1
'
resources.ApplyResources(Me.Label1, "Label1")
Me.Label1.Name = "Label1"
'
'Button2
'
resources.ApplyResources(Me.Button2, "Button2")
Me.Button2.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Button2.Name = "Button2"
Me.Button2.UseVisualStyleBackColor = True
'
'Label2
'
resources.ApplyResources(Me.Label2, "Label2")
Me.Label2.Name = "Label2"
'
'frmStaticListEditor
'
resources.ApplyResources(Me, "$this")
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.txtValue)
Me.Name = "frmStaticListEditor"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents txtValue As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Label2 As Label
End Class

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Button1.Text" xml:space="preserve">
<value>Save</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="Label2.Size" type="System.Drawing.Size, System.Drawing">
<value>159, 13</value>
</data>
<data name="Label2.Text" xml:space="preserve">
<value>Enter Listelements (One per line)</value>
</data>
<data name="Button2.Text" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Edit Static List</value>
</data>
</root>

View File

@@ -0,0 +1,279 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="txtValue.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Bottom, Left, Right</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="txtValue.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 12</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="txtValue.Multiline" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="txtValue.Size" type="System.Drawing.Size, System.Drawing">
<value>494, 211</value>
</data>
<data name="txtValue.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;txtValue.Name" xml:space="preserve">
<value>txtValue</value>
</data>
<data name="&gt;&gt;txtValue.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;txtValue.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;txtValue.ZOrder" xml:space="preserve">
<value>4</value>
</data>
<data name="Button1.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value>
</data>
<data name="Button1.Location" type="System.Drawing.Point, System.Drawing">
<value>424, 229</value>
</data>
<data name="Button1.Size" type="System.Drawing.Size, System.Drawing">
<value>82, 24</value>
</data>
<data name="Button1.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="Button1.Text" xml:space="preserve">
<value>Speichern</value>
</data>
<data name="&gt;&gt;Button1.Name" xml:space="preserve">
<value>Button1</value>
</data>
<data name="&gt;&gt;Button1.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;Button1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;Button1.ZOrder" xml:space="preserve">
<value>3</value>
</data>
<data name="Label1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 229</value>
</data>
<data name="Label1.Size" type="System.Drawing.Size, System.Drawing">
<value>20, 24</value>
</data>
<data name="Label1.TabIndex" type="System.Int32, mscorlib">
<value>2</value>
</data>
<data name="&gt;&gt;Label1.Name" xml:space="preserve">
<value>Label1</value>
</data>
<data name="&gt;&gt;Label1.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;Label1.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;Label1.ZOrder" xml:space="preserve">
<value>2</value>
</data>
<data name="Button2.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Right</value>
</data>
<data name="Button2.Location" type="System.Drawing.Point, System.Drawing">
<value>336, 229</value>
</data>
<data name="Button2.Size" type="System.Drawing.Size, System.Drawing">
<value>82, 24</value>
</data>
<data name="Button2.TabIndex" type="System.Int32, mscorlib">
<value>4</value>
</data>
<data name="Button2.Text" xml:space="preserve">
<value>Abbrechen</value>
</data>
<data name="&gt;&gt;Button2.Name" xml:space="preserve">
<value>Button2</value>
</data>
<data name="&gt;&gt;Button2.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;Button2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;Button2.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="Label2.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Bottom, Left</value>
</data>
<data name="Label2.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="Label2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="Label2.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 235</value>
</data>
<data name="Label2.Size" type="System.Drawing.Size, System.Drawing">
<value>236, 13</value>
</data>
<data name="Label2.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="Label2.Text" xml:space="preserve">
<value>Listenelemente eingeben (Ein Element pro Zeile)</value>
</data>
<data name="&gt;&gt;Label2.Name" xml:space="preserve">
<value>Label2</value>
</data>
<data name="&gt;&gt;Label2.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;Label2.Parent" xml:space="preserve">
<value>$this</value>
</data>
<data name="&gt;&gt;Label2.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 13</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>518, 265</value>
</data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterScreen</value>
</data>
<data name="$this.Text" xml:space="preserve">
<value>Statische Liste bearbeiten</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>frmStaticListEditor</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>DevExpress.XtraEditors.XtraForm, DevExpress.Utils.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
</root>

View File

@@ -0,0 +1,11 @@
Public Class frmStaticListEditor
Public Property Value() As String
Get
Return txtValue.Text
End Get
Set(value As String)
txtValue.Text = value
End Set
End Property
End Class

View File

@@ -0,0 +1,56 @@
Public Class ControlSnapPanel
Inherits Panel
Private _ShowGrid As Boolean = True
Private _GridSize As Integer = 16
Private Property AutoScaleMode As AutoScaleMode
Public Property GridSize As Integer
Get
Return _GridSize
End Get
Set(value As Integer)
_GridSize = value
Refresh()
End Set
End Property
Public Property ShowGrid As Boolean
Get
Return _ShowGrid
End Get
Set(value As Boolean)
_ShowGrid = value
Refresh()
End Set
End Property
Protected Overrides Sub OnControlAdded(e As System.Windows.Forms.ControlEventArgs)
AddHandler e.Control.LocationChanged, AddressOf AlignToGrid
AddHandler e.Control.DragDrop, AddressOf AlignToGrid
MyBase.OnControlAdded(e)
End Sub
Protected Overrides Sub OnControlRemoved(e As System.Windows.Forms.ControlEventArgs)
RemoveHandler e.Control.LocationChanged, AddressOf AlignToGrid
RemoveHandler e.Control.DragDrop, AddressOf AlignToGrid
MyBase.OnControlRemoved(e)
End Sub
Protected Overrides Sub OnPaint(e As System.Windows.Forms.PaintEventArgs)
If _ShowGrid Then
ControlPaint.DrawGrid(e.Graphics, ClientRectangle, New Size(_GridSize, _GridSize), BackColor)
End If
MyBase.OnPaint(e)
End Sub
Private Sub AlignToGrid(sender As Object, e As EventArgs)
If _ShowGrid Then
Dim item As Control = CType(sender, Control)
Dim x As Integer = Math.Round(item.Left / _GridSize) * _GridSize
Dim y As Integer = Math.Round(item.Top / _GridSize) * _GridSize
item.Location = New Point(x, y)
End If
End Sub
End Class

View File

@@ -22,37 +22,24 @@ Partial Class frmEntityDesigner
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.SplitContainerMain = New DevExpress.XtraEditors.SplitContainerControl()
Me.PanelMain = New EDMI_ClientSuite.SnapPanel()
Me.PanelMain = New EDMI_ClientSuite.ControlSnapPanel()
Me.TabControlMain = New DevExpress.XtraTab.XtraTabControl()
Me.TabPageProperties = New DevExpress.XtraTab.XtraTabPage()
Me.PropertyGridMain = New DevExpress.XtraVerticalGrid.PropertyGridControl()
Me.TabPageControls = New DevExpress.XtraTab.XtraTabPage()
Me.btnTextbox = New System.Windows.Forms.Button()
Me.btnLabel = New System.Windows.Forms.Button()
CType(Me.SplitContainerMain, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainerMain.SuspendLayout()
Me.TabPageProperties = New DevExpress.XtraTab.XtraTabPage()
Me.PropertyGridMain = New DevExpress.XtraVerticalGrid.PropertyGridControl()
Me.SplitContainerControlMain = New DevExpress.XtraEditors.SplitContainerControl()
Me.btnCombobox = New System.Windows.Forms.Button()
CType(Me.TabControlMain, System.ComponentModel.ISupportInitialize).BeginInit()
Me.TabControlMain.SuspendLayout()
Me.TabPageControls.SuspendLayout()
Me.TabPageProperties.SuspendLayout()
CType(Me.PropertyGridMain, System.ComponentModel.ISupportInitialize).BeginInit()
Me.TabPageControls.SuspendLayout()
CType(Me.SplitContainerControlMain, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainerControlMain.SuspendLayout()
Me.SuspendLayout()
'
'SplitContainerMain
'
Me.SplitContainerMain.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainerMain.Location = New System.Drawing.Point(0, 0)
Me.SplitContainerMain.Name = "SplitContainerMain"
Me.SplitContainerMain.Panel1.Controls.Add(Me.PanelMain)
Me.SplitContainerMain.Panel1.Text = "Panel1"
Me.SplitContainerMain.Panel2.Controls.Add(Me.TabControlMain)
Me.SplitContainerMain.Panel2.Text = "Panel2"
Me.SplitContainerMain.Size = New System.Drawing.Size(800, 450)
Me.SplitContainerMain.SplitterPosition = 571
Me.SplitContainerMain.TabIndex = 0
Me.SplitContainerMain.Text = "SplitContainerControl1"
'
'PanelMain
'
Me.PanelMain.AllowDrop = True
@@ -61,7 +48,7 @@ Partial Class frmEntityDesigner
Me.PanelMain.Location = New System.Drawing.Point(0, 0)
Me.PanelMain.Name = "PanelMain"
Me.PanelMain.ShowGrid = True
Me.PanelMain.Size = New System.Drawing.Size(571, 450)
Me.PanelMain.Size = New System.Drawing.Size(564, 450)
Me.PanelMain.TabIndex = 0
'
'TabControlMain
@@ -70,32 +57,17 @@ Partial Class frmEntityDesigner
Me.TabControlMain.Location = New System.Drawing.Point(0, 0)
Me.TabControlMain.Name = "TabControlMain"
Me.TabControlMain.SelectedTabPage = Me.TabPageControls
Me.TabControlMain.Size = New System.Drawing.Size(217, 450)
Me.TabControlMain.Size = New System.Drawing.Size(224, 450)
Me.TabControlMain.TabIndex = 0
Me.TabControlMain.TabPages.AddRange(New DevExpress.XtraTab.XtraTabPage() {Me.TabPageControls, Me.TabPageProperties})
'
'TabPageProperties
'
Me.TabPageProperties.Controls.Add(Me.PropertyGridMain)
Me.TabPageProperties.Name = "TabPageProperties"
Me.TabPageProperties.Size = New System.Drawing.Size(215, 425)
Me.TabPageProperties.Text = "Properties"
'
'PropertyGridMain
'
Me.PropertyGridMain.Cursor = System.Windows.Forms.Cursors.Hand
Me.PropertyGridMain.Dock = System.Windows.Forms.DockStyle.Fill
Me.PropertyGridMain.Location = New System.Drawing.Point(0, 0)
Me.PropertyGridMain.Name = "PropertyGridMain"
Me.PropertyGridMain.Size = New System.Drawing.Size(215, 425)
Me.PropertyGridMain.TabIndex = 0
'
'TabPageControls
'
Me.TabPageControls.Controls.Add(Me.btnCombobox)
Me.TabPageControls.Controls.Add(Me.btnTextbox)
Me.TabPageControls.Controls.Add(Me.btnLabel)
Me.TabPageControls.Name = "TabPageControls"
Me.TabPageControls.Size = New System.Drawing.Size(215, 425)
Me.TabPageControls.Size = New System.Drawing.Size(222, 425)
Me.TabPageControls.Text = "Controls"
'
'btnTextbox
@@ -116,31 +88,70 @@ Partial Class frmEntityDesigner
Me.btnLabel.Text = "Label"
Me.btnLabel.UseVisualStyleBackColor = True
'
'TabPageProperties
'
Me.TabPageProperties.Controls.Add(Me.PropertyGridMain)
Me.TabPageProperties.Name = "TabPageProperties"
Me.TabPageProperties.Size = New System.Drawing.Size(222, 425)
Me.TabPageProperties.Text = "Properties"
'
'PropertyGridMain
'
Me.PropertyGridMain.Dock = System.Windows.Forms.DockStyle.Fill
Me.PropertyGridMain.Location = New System.Drawing.Point(0, 0)
Me.PropertyGridMain.Name = "PropertyGridMain"
Me.PropertyGridMain.Size = New System.Drawing.Size(222, 425)
Me.PropertyGridMain.TabIndex = 0
'
'SplitContainerControlMain
'
Me.SplitContainerControlMain.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainerControlMain.FixedPanel = DevExpress.XtraEditors.SplitFixedPanel.Panel2
Me.SplitContainerControlMain.Location = New System.Drawing.Point(0, 0)
Me.SplitContainerControlMain.Name = "SplitContainerControlMain"
Me.SplitContainerControlMain.Panel1.Controls.Add(Me.PanelMain)
Me.SplitContainerControlMain.Panel1.Text = "Panel1"
Me.SplitContainerControlMain.Panel2.Controls.Add(Me.TabControlMain)
Me.SplitContainerControlMain.Panel2.Text = "Panel2"
Me.SplitContainerControlMain.Size = New System.Drawing.Size(800, 450)
Me.SplitContainerControlMain.SplitterPosition = 224
Me.SplitContainerControlMain.TabIndex = 1
Me.SplitContainerControlMain.Text = "SplitContainerControl1"
'
'btnCombobox
'
Me.btnCombobox.Location = New System.Drawing.Point(15, 77)
Me.btnCombobox.Name = "btnCombobox"
Me.btnCombobox.Size = New System.Drawing.Size(122, 23)
Me.btnCombobox.TabIndex = 1
Me.btnCombobox.Text = "Combobox"
Me.btnCombobox.UseVisualStyleBackColor = True
'
'frmEntityDesigner
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(800, 450)
Me.Controls.Add(Me.SplitContainerMain)
Me.Controls.Add(Me.SplitContainerControlMain)
Me.Name = "frmEntityDesigner"
Me.Text = "Entitäten Designer"
CType(Me.SplitContainerMain, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainerMain.ResumeLayout(False)
CType(Me.TabControlMain, System.ComponentModel.ISupportInitialize).EndInit()
Me.TabControlMain.ResumeLayout(False)
Me.TabPageControls.ResumeLayout(False)
Me.TabPageProperties.ResumeLayout(False)
CType(Me.PropertyGridMain, System.ComponentModel.ISupportInitialize).EndInit()
Me.TabPageControls.ResumeLayout(False)
CType(Me.SplitContainerControlMain, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainerControlMain.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
Friend WithEvents SplitContainerMain As DevExpress.XtraEditors.SplitContainerControl
Friend WithEvents TabControlMain As DevExpress.XtraTab.XtraTabControl
Friend WithEvents TabPageProperties As DevExpress.XtraTab.XtraTabPage
Friend WithEvents PropertyGridMain As DevExpress.XtraVerticalGrid.PropertyGridControl
Friend WithEvents TabPageControls As DevExpress.XtraTab.XtraTabPage
Friend WithEvents PanelMain As SnapPanel
Friend WithEvents PanelMain As ControlSnapPanel
Friend WithEvents btnTextbox As Button
Friend WithEvents btnLabel As Button
Friend WithEvents SplitContainerControlMain As DevExpress.XtraEditors.SplitContainerControl
Friend WithEvents btnCombobox As Button
End Class

View File

@@ -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