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
close icon

How can I detect node is in visible diagram area?

Hi...

I'd like to scroll diagram using View.ScrollToNode(Node) method only when the node is out of the visible area. How can I detect if the node is out of visible diagram area?

Thanks in advance.


3 Replies

PM Pandi Murugan A Syncfusion Team March 16, 2011 12:31 PM UTC

Hi Youngjin,

Thanks for using Syncfusion products.

We suggest you to use Diagram's Origin, ClientRectangle and Node's Bounds to achieve your requirement. Please refer the below code snippet.

[C#]
Node node = this.diagram1.Controller.SelectionList[0];
if (node.BoundingRectangle.Right < diagram1.Origin.X || node.BoundingRectangle.Bottom < diagram1.Origin.Y || (node.BoundingRectangle.Left - diagram1.Origin.X) > diagram1.ClientRectangle.Width || (node.BoundingRectangle.Bottom - diagram1.Origin.Y) > diagram1.ClientRectangle.Height)
MessageBox.Show('Invisible');
else
MessageBox.Show('Visible');


Please let me know if you have any concerns.

Regards,
Pandi Murugan A




YK Youngjin Kim March 21, 2011 06:56 AM UTC

Thanks a lot.
It works fine for me.



PM Pandi Murugan A Syncfusion Team March 22, 2011 09:45 AM UTC

Hi Youngjin,

Thanks for the update.

Please let me know if you have any other concerns.

Regards,
Pandi Murugan A


Loader.
Live Chat Icon For mobile
Up arrow icon