The zoom factor ranges from 10% to 400%.

At 150%: row heights, column widths and text all scale together

Setting it

control.Zoom = 1.5;      // 150%
control.Zoom = 1.0;      // 100%

The ZoomChanged event reports changes. Ctrl + mouse wheel is wired up by default and moves in 10% steps.

Out-of-range values are clamped (GridViewport.MinZoom / MaxZoom).

using unvell.ReoGrid.Core;
using unvell.ReoGrid.Core.Rendering;

viewport.Zoom = 1.5;                       // 150%. Out-of-range values are clamped

// the visible range accounts for zoom (pass the view size in logical pixels)
var (firstRow, lastRow) = viewport.VisibleRows(600);
var (firstCol, lastCol) = viewport.VisibleColumns(900);

A pure view transform

Zoom does not change row heights or column widths; the factor is applied only when drawing.

PlatformHow
WinFormsconverts to physical pixels as RenderScale = DpiScale × Zoom
WPF / Avaloniaapplies a ScaleTransform to the DIP drawing

On a high-DPI display, the display scaling and the zoom multiply. Zooming to 150% on a Windows display set to 150% draws at 225%.

Not the same as print scaling

Screen zoom has no effect on printed output. Print scaling is specified on PrintSettings (Printing and Page Setup).

PDF export likewise follows the print settings, not viewport.Zoom.

Saved with the sheet

The zoom factor is a per-sheet display setting (ws.View.Zoom) and is saved to reogrid-json and XLSX (5.1 and later). A zoom changed on a control is written back to ws.View, so the sheet comes back at the same zoom after switching sheets or reopening the file. XLSX stores a whole percentage.

Limitations

  • Studio (the desktop host) has no zoom UI yet
Was this article helpful?