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.

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

Thread ID:





120305 Sep 18,2015 02:43 PM Sep 21,2015 02:12 AM Windows Forms 1
Tags: Diagram
John Morris
Asked On September 18, 2015 02:43 PM

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 02:12 AM

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.

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.