Greetings to all.
I am trying to add a new type of Node to my Pallette and GoDiagram controls and for that I have subclassed the GoControl and creating my own custom control ( lets call it GoPanelControl) based on the WinForms Panel. I then created a custom Node class that derives from GoBoxNode (called GoPanelNode) and uses my control as its body. The control renders correctly and is quite usable however I find that I am unable to do a drag-and-drop of the control unless I pick it up from the underlying GoPanelNode border (I’ve made the border extra thick so I can do just that). Once placed in the diagram the node can be resized but again I cannot drag it or move it at all. I am not sure how to fix this and would appreciate any suggestions.
namespace MyCustomGoStuff
{
public enum MyNodeTypes
{
Panel;
}
public class GoPanelNode : GoBoxNode
{
public GoPanelNode()
{
Selectable = true;
Text = "Name";
Port.IsValidDuplicateLinks = true;
Port.IsValidSelfNode = false;
Resizable = true;
AutoRescales = true;
ResizesRealtime = true;
Reshapable = true;
Width = 56;
Height = Width;
IsMidLabel = false;
Editable = false;
//making border extra thick so we can somehow select and move the Node
PortBorderMargin = new SizeF(5, 5);
}
protected override GoObject CreateBody()
{
return new GoPanelControl();
}
public GoPanelControl Control
{
get
{
return base.Body as GoPanelControl;
}
}
public MyNodeTypes NodeType
{
get { return MyNodeTypes.Panel; }
}
}
public class GoPanelControl : Northwoods.Go.GoControl
{
public GoPanelControl()
{
Size = new System.Drawing.Size(80, 80);
Selectable = false;
DragsNode = false;
}
public override Type ControlType
{
get
{
return typeof(Panel );
}
set
{
}
}
public Panel _Panel;
public override GoObject CopyObject(GoCopyDictionary env)
{
GoPanelControl c = (GoPanelControl)base.CopyObject(env);
c._Panel = null; // don't share Controls!
return c;
}
public override Control CreateControl(GoView view)
{
_Panel = new Panel();
return _Panel;
}
}
}