When I link some Object with my GoIconicNode, appeared a black circle, why?
public class DataObjectItem : GoIconicNode
{
private ProcessItemImage mProcessItemImage;
private Color mfirst_color = Color.White;
private Color msecond_color = Color.White;
//Constructor with parameter to create DataObject Item
public DataObjectItem()
{
//Reset variables
mProcessItemImage = null;
ConfigureDataObjectItem();
}
//This property is for convenience in accessing the Process Item Image class
public ProcessItemImage ProcessImage
{
get { return mProcessItemImage; }
}
//Configure each DataObject process item
private void ConfigureDataObjectItem()
{
this.Initialize(null, -1, "");
this.Editable = true;
this.Shadowed = false;
this.Label.Text ="xxxx";
this.Label.Wrapping = true;
this.Label.Editable = true;
this.Label.Alignment = BottomCenter;
//Create Image and set image
ProcessItemImage m_PocessItemImage = new ProcessItemImage(ItemKind.DataObjectItem);
mProcessItemImage = m_PocessItemImage;
this.Icon = mProcessItemImage;
this.Icon.Size = new SizeF(32, 32);
//Port is whole icon, but linking may be disabled by setting goView1.AllowLink to false
this.Port.Bounds = this.Icon.Bounds;
}
}
_______________GoToolLinkingNew-----------------------
//This class configure port, links…
public class GraphViewLinkingNewTool : GoToolLinkingNew
{
//Variables
private GoPort myLastNearestPort = null;
//Constructor
public GraphViewLinkingNewTool(GoView v): base(v)
{
}
//Get elements
public override IGoPort PickNearestPort(PointF dc)
{
IGoPort iport = base.PickNearestPort(dc);
if (this.EndPort != null && this.EndPort.GoObject is GoPort)
{
if (iport != null)
{
myLastNearestPort = (GoPort)this.EndPort.GoObject;
myLastNearestPort.Style = GoPortStyle.Ellipse;
myLastNearestPort.Pen = ((ProcessView)this.View).PortHighlightPen;
}
else if (myLastNearestPort != null)
{
myLastNearestPort.Style = GoPortStyle.None;
myLastNearestPort = null;
}
}
return iport;
}
//Set port to be normal after link is completed
public override void Stop()
{
base.Stop();
if (myLastNearestPort != null)
{
myLastNearestPort.Style = GoPortStyle.None;
myLastNearestPort = null;
}
}
//Set new link, based on starter node
public override void StartNewLink(IGoPort port, PointF dc)
{
base.StartNewLink(port, dc);
}
//Check if FromPort object was already added in ToPort object
public static bool ValidSubGraphLink(IGoPort fromPort, IGoPort toPort)
{
if (fromPort == null || fromPort.Node.GoObject == null || toPort == null || toPort.Node.GoObject == null)
{
return false;
}
GoObject mfromPortObj = fromPort.Node.GoObject as GoObject;
//Check if from port node already exists in To port node
foreach (GoObject obj in toPort.Node.Sources)
{
if (obj == mfromPortObj)
{
return false;
}
}
return true;
}
public override bool IsValidLink(IGoPort fromPort, IGoPort toPort)
{
}
//Check if from port node already exists in To port node, just link one time
return base.IsValidLink(fromPort, toPort) && ValidSubGraphLink(fromPort, toPort);
}
}