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:
[C#]
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)
{
//down
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);
}
Sample:
Sample
Regards,
Naganathan K G