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

How do I use the page-up/down and arrow keys to scroll a Diagram

Thread ID:





120305 Sep 18,2015 06:43 PM UTC Sep 21,2015 06:12 AM UTC WinForms 1
Tags: Diagram
John Morris
Asked On September 18, 2015 06:43 PM UTC

I can scroll my Diagram with the mouse wheel or via the overview control.  I would also like to provide scroll capability from wither the page-up/down or arrow keys on the keyboard.

Naganathan Ganesh Babu [Syncfusion]
Replied On September 21, 2015 06:12 AM UTC

Hi John,


In order to achieve your requirement, override the “ProcessCmdKey” method and change the Diagram.View’s “Origin”, as well as “ScrollVirtualBounds.Location” values while pressing the page Up/Down keys. Please refer to the below code example and sample.


Code Example:




protected override bool ProcessCmdKey(ref Message msg, Keys keyData)


PointF origin = diagram1.View.Origin;

PointF virtualTopLeft = diagram1.View.ScrollVirtualBounds.Location;

if (keyData == Keys.PageDown)


origin.Y += 10;

virtualTopLeft.Y -= 10;


if (keyData == Keys.PageUp)



origin.Y -= 10;


//remove the unnecessary gray area at top-left when move the diagram towards left and top

diagram1.View.ScrollVirtualBounds = new RectangleF(virtualTopLeft, diagram1.View.ScrollVirtualBounds.Size);

diagram1.View.Origin = origin;  

return base.ProcessCmdKey(ref msg, keyData);









Naganathan K G


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.

Please sign in to access our forum

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

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