Programmatically Adjusting Zoom
To programmatically control the zoom level of a worksheet in ReoGrid, you can use the following methods:
sheet.ZoomIn(); // +0.1 scale factor
sheet.ZoomOut(); // -0.1 scale factor
sheet.ZoomReset(); // reset scale factor to 1
Set Scale Factor
To adjust the zoom level or scale factor of a worksheet in ReoGrid, you can directly use the SetScale
method:
sheet.SetScale(2f, Point.Empty);
This method allows you to set the scale factor, effectively zooming in or out of the worksheet view. The first argument (2f in this example) specifies the scale factor, where 1f represents the normal size, 2f would double the size, 0.5f would halve it, and so on.
The second argument of the SetScale
method is used to specify the origin point of the scale transformation. Currently, this feature is reserved for future implementation and should be set to Point.Empty
.
Zoom in/out by mouse
By holding the Ctrl key and slide mouse wheel to zoom spreadsheet in or out. This is a native built-in behavior.
Disable zoom by mouse
By change worksheet settings Behavior_MouseWheelToZoom
to false can disable the zoom-by-mouse feature.
worksheet.SetSettings(WorksheetSettings.Behavior_MouseWheelToZoom, false);
Zoom In/Out with Mouse
In ReoGrid, you can easily zoom in and out of a spreadsheet by holding the Ctrl key and using the mouse wheel. This functionality is a built-in feature, designed to provide an intuitive way for users to control the zoom level of their spreadsheet view.
Disabling Mouse Wheel Zoom
If you need to disable the zoom functionality that is triggered by the mouse wheel, you can modify the worksheet settings. Specifically, set the Behavior_MouseWheelToZoom
setting to false
:
worksheet.SetSettings(WorksheetSettings.Behavior_MouseWheelToZoom, false);