We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ControlNode within Group does not activate

I am having a bugger of a time trying to find a solution to this problem. Basically what I need is to have direct control over a windows forms control placed inside a Group node. For example, one node I need to create has several levels of text, a drop-down control, and then a "footer". I have seen one post stating that it's not possible to activate the windows forms control while inside the Group, though this post was 2 years old so I'm not sure if this is still the case. I cannot find a way to make it work so perhaps so. Solving this scenario would be the ideal solution. I see that there is a CanUngroup property of the Group node but zero documentation as to what this does - anyone know?

As an alternative, I've tried creating my own node subclass to get around this problem. I can render it how I'd like, but the problem is in how to place a windows forms control inside that node. I could definitely be missing something however it doesn't appear that there are enough hooks to do this properly. My hack was to give the subclassed Node a reference to the diagram contro (the Node class does not have a Controls property), and then add a Windows Forms control to the diagram and attempt to position within the diagram such that it shows up inside my new node. This only partially works. The control does show up in the grid but I cannot position it exactly where I want. Maybe I can get it all sorted out but resizing the grid or scrolling messes the whole thing up. I realize it's a hack anyway - probably not recommended but I'm running out of ideas. I also had the thought this morning that zooming the grid will almost certainly not work. The diagram will resize but the winforms control will not.

Does anyone have a thought as to how I might accomplish this task?

2 Replies

GM Gowri Manohari D Syncfusion Team August 4, 2009 04:47 AM UTC

Hi Doug,

Thank you for choosing Syncfusion products.

We have analyzed your requirement. Diagram control supports separate Node type "ControlNode" in order to add windows controls inside of it. ControlNode is a node used for hosting the windows controls inside of it. You can accomplish your task via this ControlNode.

The below is the sample code for adding Windows Forms TextBox in ControlNode

TextBox txt = new TextBox();
Syncfusion.Windows.Forms.Diagram.ControlNode c=new ControlNode (txt,new RectangleF (0,0,txt.Width,txt.Height));
c.ActivateStyle=ActivateStyle.ClickPassThrough;
diagram1.Model.AppendChild(c);

For more details about ControlNode please refer the sample from DashBoard->Windows Samples->Diagram Samples->Editable Diagrams->Controls Galore

Regards,
Gowri


AC Aubyn Crawford October 19, 2010 10:17 PM UTC

Hi,

I have used the ControlNode successfully (including the serliazation you use in your example) - BUT this does not appear to still work inside a group. (The Controls Galore demo's inheritance from ControlNode, but not inclusion in a group).

I can select the ControlNode as part of the group, but the mouse events never appear to be transmitted into the control hosted in the ControlNode. Is there something simple I have missed?

Thanks,


Loader.
Live Chat Icon For mobile
Up arrow icon