mjstahl
October 22, 2007, 11:14am
1
Walter,
Recently we have found that we want to round the borders of our GoMultiTextNode to differentiate if from other nodes in our document. This seemed simple enough with:
Corner = new Size();
But what we found was that the GoText's in the GoMultiText node would not conform to the surrounding border of the GoMultiTextNode. We looked for every property that would make sense and just couldn't seem to find something appropriate.
Can you point us in the right direction?
Mark Stahl
Jake
October 22, 2007, 1:22pm
2
Set the background on the GoText objects to be transparent.
Currently are application requires that the GoText objects have a background color.
Is there anyway to get around that requirement?
Thanks in advance,
Mark
Jake
October 24, 2007, 11:13am
4
The short answer is “there isn’t an easy way”.
GoText is always going to be a rectangle, and that's the way it paints.
It's possible you could override Paint for the node, and set the clip path before calling the base.Paint. But we have no samples of that.
Can you post a screenshot of what you're trying to accomplish... that might help us see another solution.
Jake
October 24, 2007, 12:20pm
5
Thanks to Walter…
[Serializable]
public class ClippingMTN : GoMultiTextNode {
public ClippingMTN() {
this.Corner = new SizeF(5, 5);
this.ItemWidth = 100;
this.ListGroup.TopLeftMargin = new SizeF(0, 0);
this.ListGroup.BottomRightMargin = new SizeF(0, 0);
}
public override void Paint(Graphics g, GoView view) {
GraphicsState oldstate = g.Save();
GoListGroup lg = this.ListGroup;
if (lg != null) {
GoRoundedRectangle rr = new GoRoundedRectangle();
rr.Bounds = lg.Bounds;
rr.Corner = lg.Corner;
GraphicsPath path = rr.MakePath();
Region reg = new Region(path);
g.IntersectClip(reg);
reg.Dispose();
path.Dispose();
}
base.Paint(g, view);
g.Restore(oldstate);
// redraw GoListGroup decoration without clipping
if (lg != null) lg.PaintDecoration(g, view);
}
}
Usage… assumes 0 margins in the LisGroup.
GoMultiTextNode nt = new ClippingMTN();
nt.Corner = new SizeF(10, 10);
GoText txt = nt.AddString("foo");
txt.BackgroundColor = Color.Red;
txt.TransparentBackground = false;
txt = nt.AddString("middle");
txt.BackgroundColor = Color.Blue;
txt.TransparentBackground = false;
txt = nt.AddString("end");
txt.BackgroundColor = Color.Yellow;
txt.TransparentBackground = false;
this.goView1.Document.Add(nt);
mjstahl
October 24, 2007, 11:52pm
6
Thanks Jake and Walter,
Once again, an amazing job. I really appreciate it.
Best regards,
Mark Stahl