I've a custom structure:
Public Structure myStruct
Public Sub New(ByVal row As Integer, ByVal Col As Integer)
X = row : Y = Col
End Sub
Property X() As Integer
Property Y() As Integer
end Structure
That I'm using as a Property in a UserControl:
Public Class myUC
inherits UserControl
Property myProp1 As String = "test"
Property MyProp2 As myStruct = New myStruct(1, 2)
End Class
If I put this UserControl on a Form the Windows Form Designer will create a piece of code in the InitializeComponent
method that looks like this:
'
'MyUC1
'
Me.MyUC1.Location = New System.Drawing.Point(205, 187)
Me.MyUC1.myProp1 = "test"
Me.MyUC1.MyProp2 = CType(resources.GetObject("MyUC1.MyProp2"), WindowsApp11.myStruct)
Me.MyUC1.Name = "MyUC1"
Me.MyUC1.Size = New System.Drawing.Size(150, 150)
Me.MyUC1.TabIndex = 0
But I would like to have myStruct serialized like the System.Drawing.Point
structure. Thus the resulting Designer code should be
'
'MyUC1
'
Me.MyUC1.Location = New System.Drawing.Point(205, 187)
Me.MyUC1.myProp1 = "test"
Me.MyUC1.MyProp2 = new WindowsApp11.myStruct(1,2)
Me.MyUC1.Name = "MyUC1"
Me.MyUC1.Size = New System.Drawing.Size(150, 150)
Me.MyUC1.TabIndex = 0
Has anyone an idea how to tell the Windows Form Designer how to serialize the custom structure. I was thinking of something like the Serialization.IXmlSerializable interface, but for Design-Time.
I've tried to find something using Google, but I seem to use the wrong search expressions.
Thx