I’m new to this and so may not have used the best approach for creating the top and bottom ports.
Here are my Initialize and CreateIcon methods. My node inherits from GoGeneralNode.
public void Initialize()<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" />
{
this.Resizable = false;
Initialize( null, @"star.gif", "New Criteria", "", 0, 0 );
this.LeftPortsAlignment = MiddleRight;
this.LeftPortLabelsInside = true;
this.LeftPortsLabelSpacing = 4;
this.RightPortsAlignment = MiddleLeft;
this.RightPortLabelsInside = true;
this.RightPortsLabelSpacing = 4;
//---------------------------------------------------------------------------
// Initialize label appearance
//---------------------------------------------------------------------------
this.TopLabel.Bold = true;
this.TopLabel.Editable = true;
this.TopLabel.FontSize = 8;
this.BottomLabel.Bold = true;
this.BottomLabel.Editable = false;
this.BottomLabel.FontSize = 8;
//---------------------------------------------------------------------------
// Add additional ports: one on the top, one on the bottom
//---------------------------------------------------------------------------
m_TopPort = CreatePort( true );
this.Add( this.TopPort );
m_BottomPort = CreatePort( false );
this.Add( this.BottomPort );
//---------------------------------------------------------------------------
// Temporary - Create Button
//---------------------------------------------------------------------------
GoButton but = new GoButton();
but.Selectable = false;
but.Text = "?";
but.TopLeftMargin = new SizeF( 0, 0 );
but.BottomRightMargin = new SizeF( 0, 0 );
Insert( 2, but ); // == this[2]
but.Action += new GoInputEventHandler( but_Action );
}
///
/// Generated the body (i.e. Icon) of the display node.
/// This consists of two rounded rectangles (top and bottom), each holding a label
///
///
///
///
protected override GoObject CreateIcon( System.Resources.ResourceManager res, string iconname )
{
// Top rectangle
GoRoundedRectangle r1 = new GoRoundedRectangle();
r1.Selectable = false;
r1.Size = new SizeF( 100, 20 );
r1.RoundedCornerSpots = TopLeft | TopRight;
r1.FillSimpleGradient( Color.Green, Color.PaleGreen, MiddleTop );
// Bottom rectangle
GoRoundedRectangle r3 = new GoRoundedRectangle();
r3.Selectable = false;
r3.Size = new SizeF( 100, 20 );
r3.RoundedCornerSpots = BottomLeft | BottomRight;
r3.FillSimpleGradient( Color.PaleGreen, Color.Green, MiddleTop );
// Container
GoListGroup list = new GoListGroup();
list.Selectable = false;
list.AutoRescales = false;
list.TopLeftMargin = new SizeF( 0, 0 );
list.BottomRightMargin = new SizeF( 0, 0 );
list.Add( r1 );
list.Add( r3 );
return list;
}