Search
Step 3: Define a public constructor

Define a constructor to initialize the instance members.

C#  Copy Code

public IconNode(Diagram diagram) : base(diagram)
{
    icon = defaultIcon;
    label = "Label";

    format = new StringFormat();
    format.Alignment = StringAlignment.Center;
    format.LineAlignment = StringAlignment.Center;

    Bounds = new RectangleF(Bounds.Location, CalculateSize());
}

Visual Basic  Copy Code

Sub New(ByVal diagram As Diagram)

    MyBase.New(diagram)

    fIcon = defaultIcon
    fLabel = "Label"

    format = New StringFormat
    format.Alignment = StringAlignment.Center
    format.LineAlignment = StringAlignment.Center

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

End Sub