Scrolling the Diagram using Page Down/Up keys and Arrow keys
Scrolling the Diagram using Page Down/Up keys and Arrow keys
Syncfusion® Diagram supports scrolling the diagram with the help of keyboard interaction. To achieve this functionality, override the ProcessCmdKey method and change the Diagram.View’s "Origin" as well as "ScrollVirtualBounds.Location" values while pressing the Page Up/Down keys.
The below code shows how to scroll diagram while pressing page Up/Down keys.
[C#]
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; }
[VB]
Dim origin As PointF = diagram1.View.Origin Dim virtualTopLeft As PointF = diagram1.View.ScrollVirtualBounds.Location If keyData = Keys.PageDown Then origin.Y += 10 virtualTopLeft.Y -= 10 End If If keyData = Keys.PageUp Then 'down origin.Y -= 10 End If
Conclusion
I hope you enjoyed learning about scrolling the diagram using Page Down/Up keys and Arrow keys.
You can refer to WinForms Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms Diagram example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!