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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to programatically select (highlight in diagram) a diagram node?

Thread ID:

Created:

Updated:

Platform:

Replies:

72289 Mar 12,2008 08:57 AM UTC Mar 21,2008 03:29 PM UTC Windows Forms 5
loading
Tags: Diagram
Colin
Asked On March 12, 2008 08:57 AM UTC

Hello,
I would like to select programmatically some specific nodes in my diagram, that is, to show them as selected (highlighted, showing the handlers). Is there any way to do this?
Thanks, Colin


Administrator [Syncfusion]
Replied On March 14, 2008 11:28 AM UTC

Hi Colin,

Thank you for your interest in Syncfusion Products.

By default, when selecting nodes at run time itself, it is not possible to select multiple nodes individually. When we select multiple nodes, it will be selected as like

GroupNodes. Please refer the following videoclip that illustrates this behaviour:

http://websamples.syncfusion.com/samples/Diagram.Windows/F72289/VideoClip.zip

Please let me know if any concerns.

Regards,
Fathima


Colin
Replied On March 15, 2008 01:54 PM UTC

Hello Fathima,
Thank you for your help and your answer. However, my concern was how to PROGRAMATICALLY select -highlight / make the handlers visible- a node in a diagram (without any user input in the diagram itself; actually, the node will be selected by the users from within a list of nodes -defined by their label- elsewhere, and I would like to reflect this choice by highlighting the corresponding node in the diagram).
I was trying to find something like:
Rectangle ChosenNode = NodeChosenByTheUserInAList;
diagram1.Model.Nodes[ChosenNode.Name].Select();
But I couldn't find any such solution.
I hope this clarifies a bit my issue...
Thank you for your help,
Regards, Colin


Administrator [Syncfusion]
Replied On March 18, 2008 08:17 AM UTC

Hi Colin,

Thank you for your update.

To select a particular node programmatically, curently we dont have any specific method. We need to add the nodes to the selection list so that the nodes will get selected. Please refer the following code snippets that illustrates this:

NodeCollection nodes = this.diagram1.Model.Nodes;
foreach (Node n in nodes)
{
if (n.Name.Equals("rec2"))
diagram1.View.SelectionList.Add(n);
}

Please find the simple sample in the following link:

http://websamples.syncfusion.com/samples/Diagram.Windows/F72289_1/main.htm

Please let me know if any concerns.

Regards,
Fathima


Colin
Replied On March 20, 2008 03:36 PM UTC

Hi Fathima,
I am experiencing problems to open the sample you linked... But the sample code you wrote was exactly what I was looking for!
Thanks a lot for you help with this issue!
Regards,
Colin


Leo
Replied On March 21, 2008 03:29 PM UTC

I had a similar question with regards to selecting node programmatically. I used the provided example and it did work. The problem is that my node when I select it programmatically, become resizable even though the following properties are set to false:
EditStyle.AllowRotate = false
EditStyle.AllowChangeHeight = false
EditStyle.AllowChangeWidth = false

When the node is selected by mouse-click the resizing points of the selection are disabled.
They become enabled only when node is selected programmatically. How can I keep them disabled?

Thanks,
Leo



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;