Hi,
I am trying to make a test application, so I can persuade my managers to buy goDiagram .
I read the gowin tutorial some days ago.
I need to show a organigram , only show and select nodes, no edit / drag drop / creates …
I want to have the nodes show an icon and a string … so I started from the example FlowGrammer, where the actions and effects have the same requirements :
I added my profile.ico to my resource : Images.resx
I loaded the resource manager :
GoImage.DefaultResourceManager = new ResourceManager(“WindowsApplication.Images”, this.GetType().Assembly);
and i derived a class from goTextNode
public class ProfileNode : GoTextNode {
public ProfileNode() {
this.Shadowed = true;
this.Resizable = false;
this.Label.Alignment = GoObject.Middle;
this.Label.Multiline = false;
this.Label.Wrapping = true;
this.Brush = Brushes.LightBlue;
this.Label.Editable = true;
this.LeftPort = null;
this.RightPort = null;
this.Resizable = false;
this.Bounds = new RectangleF(300, 300, 1000, 1000);
this.Text = "STijn Ver Eecke";
SizeF margins = this.TopLeftMargin;
this.TopLeftMargin = new SizeF(margins.Width + 4 + StandardImageSize.Width, margins.Height);
// add the GoImage
GoImage img = new GoImage();
img.Selectable = false;
img.Size = GoObject.LargestSizeKeepingAspectRatio(StandardImageSize, img.Size);
Add(img);
img.Name = "profile";
}
public readonly SizeF StandardImageSize = new SizeF(32, 32);
public override void LayoutChildren(GoObject childchanged) {
base.LayoutChildren(childchanged);
GoImage img = this.Image;
GoText lab = this.Label;
if (img != null && lab != null) {
PointF p = lab.GetSpotLocation(MiddleLeft);
p.X -= 4; // space between image and label
img.SetSpotLocation(MiddleRight, p);
}
}
public GoImage Image {
get {
foreach (GoObject obj in this) {
GoImage img = obj as GoImage;
if (img != null)
return img;
}
return null;
}
}
…
}
Then I just add the node to a document and that document to my view …
I get to see a rectangular node, displaying my Text, but no Image …
Any tips on what I am doing wrong ???