I have a subgraph to which I can add elements at run time.
In my object's constructor I initialize the subgraph
[code]this.Opacity = 100; // background color
this.Text = String.Empty;
this.CollapsedBottomRightMargin = new SizeF(0F,0F);
this.CollapsedTopLeftMargin = new SizeF(0F,0F);
this.Label.Wrapping = true;
this.Handle.Position = this.Position;
myTopPort = MakePort(GoObject.MiddleTop);
myBottomPort = MakePort(GoObject.MiddleBottom);
Pen p = new Pen(Color.Gray);
p.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.BorderPen = p;
this.BackgroundColor = Color.Aquamarine;
this._subgraphDictionary = new Block_Node_Dictionary();[/code]
Since initially the subgraph does not have any children it comes out very small on the screen and the requirement for my project is that the subgraph gets initially drawn with size(50F,50F)
I tried the following:
[code]if (this.Count == 4) //Subgraph is empty it only has the ports and the handle
this.Size = new SizeF(50F, 50F);[/code]
I also tried setting the width and the height of the subgraph to 50F but nothing hels - it is always drawn initially very small and then expands as I add items to it.
I tried setting the Autorescales to false and all he oteh similar properties.
The only thing that seems to work is if I set the Bottomright margin and the TopLeft margin
But then my top ad bottom ports end up some distance from the edge of the rectangle.
How can I handle this case?