Overriding paint in a subgraph label

I am using a derived GoText for the label in my derived subgraph class, by overriding the CreateLabel method.
The derived GoText class overrides the Paint method to render the text with a border pen and a fillbrush.
When I collapse the subgraph, the label is drawn half inside and half outside of the collapsed subgraph in the lower right corner (the label is a rather big size 22 text). This only happens when I override the paint method. When I don’t override paint, it works fine, and the label is drawn inside the collapsed subgraph.
I guess I must be missing something about either updating the bounds of the derived GoText, or the computelayout of the collapsed subgraph label / collapsed label spot or something else. From the documentation I can’t figure out what is missing.
The overriden Paint method in the derived GoText class:

public override void Paint(Graphics g, GoView view)<?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

{

GraphicsPath path = new GraphicsPath();

path.AddString(Text,Font.FontFamily,(int) FontStyle.Regular,Font.Size,Location,StringFormat.GenericTyp ographic);

g.FillPath(brush,path);

//draw outlined text

g.DrawPath(pen,path);

path.Reset();

path.Dispose();

} I override the CreateLabel in my derived subgraph:

protected override GoText CreateLabel()

{

Pen pen = new Pen(darkGreenColor,2.0f);

MiGoText result = new MiGoText (pen ,Brushes.Transparent);

result.Selectable = false;

result.Alignment = TopLeft;

return result;

} Any ideas to what I am missing ? Please also see my post from last thursday about disabling snap-to-grid for some object. Regards Stig Nielsson

Whenever you override GoObject.Paint to (possibly) paint outside the Bounds of the object, you also need to override ExpandPaintBounds correspondingly, so that updating of the view can work correctly.
Which version are you using? In 2.3 we removed the restriction that the GoSubGraph border area be the same as the Bounds. So now it’s easier to have the Label (for instance) be outside of the bordered area of the subgraph, by overriding ComputeInsideMarginsSkip to return true for the Label and LayoutLabel to position the label as desired. (Other overrides might also be needed, depending on what you are doing.)