Search
Step 6: Define custom properties

Define custom properties. For example IconNode defines properties that specify the icon image and label.

C#  Copy Code

public Image Icon
{
    get { return icon; }
    set
    {
        icon = value;
        Bounds = new RectangleF(Bounds.Location, CalculateSize());
    }
}

public string Label
{
    get { return label; }
    set
    {
        label = value;
        Bounds = new RectangleF(Bounds.Location, CalculateSize());
    }
}

Visual Basic  Copy Code

Public Property Icon() As Image

    Get
        Return fIcon
    End Get

    Set(ByVal Value As Image)

        fIcon = Value
        Bounds = New RectangleF(Bounds.Location, CalculateSize())

    End Set

End Property

Public Property Label() As String

    Get
        Return fLabel
    End Get

    Set(ByVal Value As String)

        fLabel = Value
        Bounds = New RectangleF(Bounds.Location, CalculateSize())

    End Set

End Property