Northwoods.Go Assembly > Northwoods.Go Namespace : GoBasicNode Class |
'Declaration <SerializableAttribute()> Public Class GoBasicNode Inherits GoNode Implements IGoCollection, IGoGraphPart, IGoIdentifiablePart, IGoLabeledNode, IGoLabeledPart, IGoNode
[SerializableAttribute()] public class GoBasicNode : GoNode, IGoCollection, IGoGraphPart, IGoIdentifiablePart, IGoLabeledNode, IGoLabeledPart, IGoNode
By default the Shape is a GoEllipse. You can easily replace that shape with a GoRectangle or other GoShape. If you call the GoBasicNode Constructor(GoFigure) constructor, the shape will be a GoDrawing initialized to have that GoFigure.
The position and size of the Label relative to the Shape is determined by the LabelSpot property. When the spot is GoObject.Middle, the shape is automatically resized to fit the label's text (if AutoResizes is true) plus the MiddleLabelMargin, and the port is hidden and resized to be the same size as the shape itself.
When AutoResizes is false, the Label is sized to fit inside the bounds of the Shape, minus the margins. The label (a GoText) is automatically wrapped and clipped.
Since the default value for LabelSpot is GoObject.MiddleTop
, you will need to explicitly set the LabelSpot to GoObject.Middle
to get this appearance and behavior. Otherwise the default appearance is to have the Label be positioned outside of the Shape, with the Port small and positioned in the middle of the Shape.
Unless you set the Text or the Label property, there will be no Label. However, the GoBasicNode Constructor(GoFigure) constructor does create a Label, in addition to having the label be in the middle of the shape.
When the Shape is an instance of GoDrawing, you can get and set the Figure property, if you want to dynamically change the appearance of the node. More generally, you can modify that GoDrawing or replace the Shape with another kind of GoShape.
Setting the GoNode.Location, GoNode.Resizable, GoNode.Reshapable and GoNode.Shadowed properties actually set the same properties on the node's SelectionObject, which is the Shape.
GoBasicNode node1 = new GoBasicNode(); node1.LabelSpot = GoObject.Middle; node1.Text = "basic node 1"; node1.Shape.BrushColor = Color.LightGreen; node1.Location = new PointF(75, 50); goView1.Document.Add(node1); GoBasicNode node2 = new GoBasicNode(GoFigure.CreateRequest); node2.Text = "basic node 2"; node2.Shape.BrushColor = Color.LightYellow; node2.Location = new PointF(200, 50); goView1.Document.Add(node2); GoLink link = new GoLink(); link.ToArrow = true; link.FromPort = node1.Port; link.ToPort = node2.Port; goView1.Document.Add(link);
System.Object
Northwoods.Go.GoObject
Northwoods.Go.GoGroup
Northwoods.Go.GoNode
Northwoods.Go.GoBasicNode
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2