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

CustomOverview functionality using MouseMove

Platform: WinForms |
Control: Diagram |
Published Date: November 25, 2015 |
Last Revised Date: June 2, 2019

CustomOverview functionality using MouseMove

Syncfusion Diagram supports for the creation of own custom overview control from the predefined OverviewControl.


The following code snippet is used to add an overview control in diagram



CustomOverView overview1 = new CustomOverView();
//Positioning the overview control using DockStyle 
overview1.Dock = DockStyle.Right;
overview1.Diagram = diagram2;



Dim overview1 As New CustomOverView()
‘Positioning the overview control using DockStyle 
overview1.Dock = DockStyle.Right
overview1.Diagram = diagram2


The below code shows customizing the overview control.


class CustomOverView : OverviewControl
        bool action = false;
        public CustomOverView()
            : base()



Friend Class CustomOverView
 Inherits OverviewControl
  Private action As Boolean = False
  Public Sub New()
  End Sub
End Class


The overview control only displays the diagram’s impact when mouse up event is fired. This can be customized by displaying the impact when the mouse is moved.

The below code snippet shows how to customize the overview control.


protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs meargs)
            if (action)
                if ((this.dgmModel != null) && (this.dgmView != null))
               // Creates an impact of diagram control while moving
                    if (this.ptDragStart != Point.Empty)
                        bViewportInitiated = true;
                        if (this.dragMarker != RectMarkers.Viewport)
                            this.vpRenderer.SizingRect = RectangleF.Empty;
                            if ((this.rcInDragArea.Width > 5) && (this.rcInDragArea.Height > 5))
                                this.ViewportBounds = this.rcInDragArea;
                if (dgmView != null)
                    // Set the view origin based on the viewport's pan location.
                    PointF origin = new PointF(
                        (this.ViewportBounds.X - this.rcDisplayArea.X) / this.scaleFactor,
                        (this.ViewportBounds.Y - this.rcDisplayArea.Y) / this.scaleFactor);
                    this.View.Origin = new PointF(origin.X, origin.Y);



Protected Overrides Sub OnMouseMove(ByVal meargs As System.Windows.Forms.MouseEventArgs)
If action Then
If (Me.dgmModel IsNot Nothing) AndAlso (Me.dgmView IsNot Nothing) Then
If Me.ptDragStart <> Point.Empty Then
bViewportInitiated = True
If Me.dragMarker <> RectMarkers.Viewport Then
Me.vpRenderer.SizingRect = RectangleF.Empty
If (Me.rcInDragArea.Width > 5) AndAlso (Me.rcInDragArea.Height > 5) Then
Me.ViewportBounds = Me.rcInDragArea
End If
End If
End If
End If
If dgmView IsNot Nothing Then
‘Set the view origin based on the viewport's pan location.
Dim origin As New PointF((Me.ViewportBounds.X - Me.rcDisplayArea.X) / Me.scaleFactor, (Me.ViewportBounds.Y - Me.rcDisplayArea.Y) / Me.scaleFactor)
Me.View.Origin = New PointF(origin.X, origin.Y)
End If
End If
End Sub


2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
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