Hi Support!
I need a help to adjust 2 objects inside GoBoxNode. How can I do it? See my code and image? Thanks!
[Serializable]
public class InfoNode : GoBoxNode
{
//Variables
private int CellGridSize = 1;
private int MinSizeW = 50;
private int MinSizeH = 50;
public InfoNode()
{
this.Resizable = true;
this.ResizesRealtime = true;
this.PortBorderMargin = new SizeF(0, 0);
this.Port.BrushColor = Color.White;
this.Port.PenColor = Color.Black;
this.LinkPointsSpread = true;
Initialize();
}
private void Initialize()
{
GoListGroup mListGroup = new GoListGroup();
mListGroup.Selectable = false;
mListGroup.Add(CreateGrid());
mListGroup.Add(CreateLabel());
this.Body = mListGroup;
}
public override void LayoutChildren(GoObject childchanged)
{
GoListGroup grp = this.Body as GoListGroup;
if (grp == null || grp.Count < 2) return; // do nothing until Initialize'd
RectangleF r = this.Bounds; // get the Bounds before changing anything
GoObject mGrid = grp[0];
GoObject mText = grp[1];
base.LayoutChildren(childchanged); // lays out Port using Body's Bounds
}
public override void DoResize(GoView view, RectangleF origRect, PointF newPoint, int whichHandle, GoInputState evttype, SizeF min, SizeF max)
{
base.DoResize(view, origRect, newPoint, whichHandle, evttype, new SizeF(MinSizeW, MinSizeH), max); // specify minimum resizing Size
}
//Get Main Group
public GoListGroup MainListGroup
{
get
{
if (this.Body is GoListGroup)
{
return (GoListGroup)this.Body;
}
else
{
return null;
}
}
}
//Get Text
public override GoText Label
{
get
{
if (this.MainListGroup == null)
{
return null;
}
else
{
GoListGroup mGroup = this.MainListGroup;
return mGroup[1] as GoText;
}
}
}
//Get Grid
public virtual GoGrid Grid
{
get
{
if (this.MainListGroup == null)
{
return null;
}
else
{
GoListGroup mGroup = this.MainListGroup;
return mGroup[0] as GoGrid;
}
}
}
//Create Grid
private GoGrid CreateGrid()
{
GoGrid grid = new GoGrid();
grid.Selectable = false;
grid.AutoRescales = true;
grid.Resizable = true;
grid.ResizesRealtime = true;
grid.Bounds = new RectangleF(0, 0, 150, 100);
grid.SnapDrag = GoViewSnapStyle.Jump;
grid.SnapResize = GoViewSnapStyle.Jump;
grid.CellSize = new SizeF(CellGridSize, CellGridSize);
grid.Style = GoViewGridStyle.None;
grid.Pen = new Pen(Color.Black, 2);
grid.BrushColor = Color.White;
return grid;
}
//Create label
private GoText CreateLabel()
{
//Label Left Side
RotatedText label = new RotatedText();
label.Text = "12";
label.Selectable = false;
label.Multiline = true;
label.Editable = true;
label.FontSize = 11;
label.TransparentBackground = false;
label.BackgroundColor = Color.White;
label.Bordered = true;
// settings for rotation.
label.AutoResizes = false;
label.Alignment = Middle;
label.Angle = 270;
return label;
}
}