)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Multiple Diagrams Scrolling together

Platform: WinForms |
Control: Diagram |
Published Date: June 30, 2016 |
Last Revised Date: May 31, 2019

Mirroring of scrolling operation in Multiple Diagrams

The mirroring of scrolling operation can be achieved by using Diagram’s event sink’s OriginChanged event. Need to create separate OriginChanged event for both the diagrams/views and assign the new origin by means of vice versa (i.e.) Need to assign the 2nd diagram’s new origin in the 1st diagram’s OriginChanged event and assign the 1st diagram’s new origin in the  2nd diagram’s OriginChanged event.

 

The below attached code snippet for scrolling the multiple diagrams together:

 

[C#]

//initializing the Origin changed event for both diagrams
diagram1.EventSink.OriginChanged +=new ViewOriginEventHandler(Diagram1EventSink_OriginChanged);
diagram2.EventSink.OriginChanged += new ViewOriginEventHandler(Diagram2EventSink_OriginChanged);
 
private void Diagram1EventSink_OriginChanged(ViewOriginEventArgs evtArgs)
{
//Assiging the new origin value of Diagram1 to the Diagram2 while scrolling the Diagram1
diagram2.View.Origin = evtArgs.NewOrigin;
diagram2.Refresh();
}
 
private void Diagram2EventSink_OriginChanged(ViewOriginEventArgs evtArgs)
{
//Assiging the new origin value of Diagram2 to the Diagram1 while scrolling the Diagram2
diagram1.View.Origin = evtArgs.NewOrigin;
diagram1.Refresh();
}

 

[VB]

'initializing the Origin changed event for both diagrams
Private diagram1.EventSink.OriginChanged += New ViewOriginEventHandler(AddressOf Diagram1EventSink_OriginChanged)
Private diagram2.EventSink.OriginChanged += New ViewOriginEventHandler(AddressOf Diagram2EventSink_OriginChanged)
 
Private Sub Diagram1EventSink_OriginChanged(ByVal evtArgs As ViewOriginEventArgs)
'Assiging the new origin value of Diagram1 to the Diagram2 while scrolling the Diagram1
diagram2.View.Origin = evtArgs.NewOrigin
diagram2.Refresh()
End Sub
 
Private Sub Diagram2EventSink_OriginChanged(ByVal evtArgs As ViewOriginEventArgs)
'Assiging the new origin value of Diagram2 to the Diagram1 while scrolling the Diagram2
diagram1.View.Origin = evtArgs.NewOrigin
diagram1.Refresh()
End Sub
 

 

Sample Link:

Sample

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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

Live Chat Icon For mobile
Live Chat Icon