If you want to do this, you have to create a class which has the needed Properties. This class should be the Type of your "new Property".
Example :
Imports System.ComponentModel
Imports System.ComponentModel.Design
<TypeConverter(GetType(PaddingDefinition.Converter))>
Public Class PaddingDefinition
<Description("distance of text to the left side")>
Property Left As Integer
Get
Return _left
End Get
Set(ByVal value As Integer)
If _left <> value Then
_left = value
RaiseEvent Changed()
End If
End Set
End Property
Private _left As Integer = 5
<Description("distance of text to the right side")>
Property Right As Integer
Get
Return _right
End Get
Set(ByVal value As Integer)
If _right <> value Then
_right = value
RaiseEvent Changed()
End If
End Set
End Property
Private _right As Integer = 5
Public Event Changed()
Sub New()
End Sub
Sub New(ByVal left As Integer, ByVal right As Integer)
_left = left
_right = right
RaiseEvent Changed()
End Sub
Overrides Function toString() As String
Return Left.ToString.Trim & ";" & Right.ToString.Trim
End Function
Function toPadding() As Padding
Return New Padding(_left, 0, _right, 0)
End Function
Sub fromPadding(setPadding As Padding)
_left = setPadding.Left
_right = setPadding.Right
RaiseEvent Changed()
End Sub
Public Class Converter
Inherits ExpandableObjectConverter
Public Overloads Overrides Function CanConvertFrom(ByVal context As ITypeDescriptorContext, ByVal sourceType As Type) As Boolean
If sourceType Is GetType(String) Then
Return True
Exit Function
End If
Return MyBase.CanConvertFrom(context, sourceType)
End Function
Public Overloads Overrides Function ConvertFrom(ByVal context As ITypeDescriptorContext, ByVal culture As System.Globalization.CultureInfo, ByVal value As Object) As Object
If value.GetType Is GetType(String) Then
Dim s As String = CType(value, String)
Dim sa As String() = Split(s, ";")
If sa.Length >= 2 Then
Dim p1, p2 As Integer
If Integer.TryParse(sa(0), p1) AndAlso Integer.TryParse(sa(1), p2) Then
Return New PaddingDefinition(p1, p2)
Exit Function
End If
End If
Throw New FormatException()
End If
Return MyBase.ConvertFrom(context, culture, value)
End Function
End Class
End Class
and now the use of it :
<Category("Design"), Description("defines the distances inside the control")>
<DesignerSerializationVisibility(DesignerSerializationVisibility.Content)>
<DefaultValue("5;5")>
Shadows Property Padding As PaddingDefinition
Get
Return my_Padding
End Get
Set(ByVal value As PaddingDefinition)
my_Padding = value
End Set
End Property
Private WithEvents my_Padding As New PaddingDefinition
<RefreshProperties(RefreshProperties.All)>
Private Sub Padding_Changed() Handles my_Padding.Changed
End Sub
I hope this gives you an idea ...
Edit :
I have seen (perhaps a little to late) that the question points to C#.
My Solution is for VB. 8)
But nevertheless - it shows how it could be done ...