Dear, <?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
We are using GoTextNode to display our data as displayed below.
<?:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />
We have GoFuigers (built in) and UserDefined icons as well in our tool box. The issue(s) are:
When we put long text for the node it looses it’s original shape as displayed above. We want node Figure to remain fix in size but node Text can grow up to any length.
As we have userdefined icons too, so how to assign them to figure property of GoTextNode. right now we are setting the background of node inplace of figure.
The background object in GoTextObject is define to wrap around the text label plus the margin.
So, what you're seeing is what we'd expect.
To get the behavior you'd want, you'd have to derive a class similar to DecoratedTextNode in Demo1 (except you would make the decoration a GoShape instead of a GoImage).
shown above selected and not selected with Background.Visible=false and on the bottom with Background.Visible = true;
[code]
using System; using System.Drawing; using Northwoods.Go; using Northwoods.Go.Draw;
namespace Demo1 {
// A GoTextNode with a decoration near the top right corner, // showing an image "behind" the Background shape and some text // centered on the image. [Serializable] public class ShapeTextNode : GoTextNode { public ShapeTextNode() { // create the decoration GoDrawing decoration = new GoDrawing(GoFigure.Cylinder1); decoration.Resizable = false; decoration.Selectable = false;
// add margin for the Shape this.TopLeftMargin = new SizeF(height + 8, 4); this.BottomRightMargin = new SizeF(4, 4);
// put the decoration behind the Background shape Add(decoration); // initialize this node... this.Text = "ShapeTextNode"; this.Background.Visible = false; }
// this field keeps track of this group's decoration private GoDrawing myDecoration = null;
// update the field to refer to the copied decoration if the node is copied protected override void CopyChildren(GoGroup newgroup, GoCopyDictionary env) { base.CopyChildren(newgroup, env); ShapeTextNode node = (ShapeTextNode)newgroup; node.myDecoration = (GoDrawing)env[myDecoration]; }
// this property is for convenience in accessing the decoration public GoDrawing Decoration { get { return myDecoration; } }
// these two properties are for convenience, if you want to get or set their values
public GoFigure DecorationFigure { get { GoDrawing dec = this.Decoration; if (dec != null) return dec.Figure; else return GoFigure.Decision; } set { GoDrawing dec = this.Decoration; if (dec != null) dec.Figure = value; } }
// position the BottomRight of the decoration's Label to be just // above this node's Background, aligned with the right edge of this node's Label public override void LayoutChildren(GoObject childchanged) { base.LayoutChildren(childchanged);
GoDrawing dec = this.Decoration; if (dec != null && this.Background != null && this.Label != null) { dec.SetSpotLocation(MiddleRight, this.Label, MiddleLeft, new SizeF(-4,0)); } } }
I taken help from your code and able to implement in my class. Now Figure and Text are coming fine as i wanted. but any how i have a problem with the link now using this code. see the image below
1.Now the link arrow is coming over the Figure but we want the link Arrow to come up to Node's left corner.
2.The Ports are coming arround the text but we want them to be arround the Figure.
Looks like you are positioning all of your ports relative to the text label, and not taking the Figure into account. My code above puts the ports on the four sides of the bounding rect, which is the default GoTextNode behavior.