Hello,
I need a MultiNodePort in my project. So I used the MultiNodePort exemple in demo1. The MultiPortNode class is the same as in the Demo1.
This is the node class :
[code][Serializable]
public class bnode : GoIconicNode
{
public bnode(string image, string label)
{
this.Initializing = true;
this.ResizesRealtime = true;
mpn.Initialize(null, image, label);
mpn.Label.SetSpotLocation(GoObject.BottomCenter, mpn.Icon, GoObject.BottomCenter);
mpn.Icon.Size = new SizeF(103, 67);
mpn.Shadowed = true;
mpn.Resizable = true;
mpn.ResizesRealtime = true;
mpn.Label.Editable = true;
up = (MultiPortNodePort)mpn.AddPort(1, new SizeF(51, 0), GoObject.MiddleTop, 1);
up.BrushColor = Color.White;
up.IsValidFrom = false;
up.IsValidTo = true;
left = (MultiPortNodePort)mpn.AddPort(2, new SizeF(0, 33), GoObject.TopLeft, 2);
left.BrushColor = Color.White;
left.IsValidFrom = true;
left.IsValidTo = false;
right = (MultiPortNodePort)mpn.AddPort(3, new SizeF(103, 33), GoObject.TopRight, 3);
right.BrushColor = Color.White;
right.IsValidFrom = true;
right.IsValidTo = false;
this.Initializing = false;
}
public void add(GoDocument dest_doc) { dest_doc.Add(mpn); }
private MultiPortNode mpn = new MultiPortNode();public class bnode : GoIconicNode
{
public bnode(string image, string label)
{
this.Initializing = true;
this.ResizesRealtime = true;
mpn.Initialize(null, image, label);
mpn.Label.SetSpotLocation(GoObject.BottomCenter, mpn.Icon, GoObject.BottomCenter);
mpn.Icon.Size = new SizeF(103, 67);
mpn.Shadowed = true;
mpn.Resizable = true;
mpn.ResizesRealtime = true;
mpn.Label.Editable = true;
up = (MultiPortNodePort)mpn.AddPort(1, new SizeF(51, 0), GoObject.MiddleTop, 1);
up.BrushColor = Color.White;
up.IsValidFrom = false;
up.IsValidTo = true;
left = (MultiPortNodePort)mpn.AddPort(2, new SizeF(0, 33), GoObject.TopLeft, 2);
left.BrushColor = Color.White;
left.IsValidFrom = true;
left.IsValidTo = false;
right = (MultiPortNodePort)mpn.AddPort(3, new SizeF(103, 33), GoObject.TopRight, 3);
right.BrushColor = Color.White;
right.IsValidFrom = true;
right.IsValidTo = false;
this.Initializing = false;
}
private MultiPortNodePort up = null;
private MultiPortNodePort left = null;
private MultiPortNodePort right = null;
}[/code] I trying to use the RegisterTransformers function of the user guide, where I have just added that : [code] MultiPortNode mpn = new MultiPortNode();
mpn.Text = "";
mpn.Initialize(null, "", "");
GoXmlBindingTransformer bt2 = new GoXmlBindingTransformer("mynode", mpn);
bt2.HandlesNamedPorts = true;
bt2.AddBinding("SetSpotLocation", "SetSpotLocation");
bt2.AddBinding("label", "Text");
bt2.AddBinding("image", "Icon.Name");
bt2.AddBinding("iconsize", "Icon.Size");
bt2.AddBinding("Location", "Location");
rw.AddTransformer(bt2); MultiPortNodePort gnp = new MultiPortNodePort();
gnp.UserFlags = 0;
gnp.Center = new PointF();
gnp.FromSpot = 0;
gnp.ToSpot = 0;
gnp = (MultiPortNodePort)mpn.AddPort(0, new SizeF(), 0, 0);
GoXmlBindingTransformer btp = new GoXmlBindingTransformer(gnp);
btp.HandlesNamedPorts = true;
btp.IdAttributeUsedForSharedObjects = true;
btp.AddBinding("forme", "MultiPortNodePort.forme");
btp.AddBinding("Style", "Style");
btp.AddBinding("from", "FromPSpot");
btp.AddBinding("to", "ToSpot");
btp.AddBinding("Center", "Center");
btp.AddBinding("loc1", "Location");
btp.AddBinding("GoPortStyle1", "GoPortStyle");
btp.AddBinding("Center1", "Center");
btp.AddBinding("left", "LeftSide");
btp.AddBinding("name", "Name");
rw.AddTransformer(btp);[/code] But Nodes and ports are not saved in a XML database.
I try a lot of bindings without succes.
Could you help me, please?