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 touch the model. Row heights and column widths keep their values; 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.

Not saved

The zoom factor is run-time state and is saved to neither reogrid-json nor XLSX. Persisting a per-sheet zoom is future work.

Limitations

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