V4 V5

The package is unvell.ReoGrid.One and the namespace is unvell.ReoGrid.WinForms. It draws with GDI+ (the default) or Direct2D — see “Renderer” below.

For getting started and sample code, see WinForms Quick Start. This page is the member list.

Workbook

MemberWhat it does
WorkbookThe workbook it holds
ActiveWorksheetThe sheet being displayed
SetWorksheet(ws)Switches which sheet is displayed
LoadWorkbook(wb)Replaces the whole workbook
NewWorkbook()A new one (with a single Sheet1)
LoadJson(json)Loads from reogrid-json
WorkbookChanged / ActiveSheetChangedEvents

new ReoGridControl() starts out holding a single Sheet1.

Selection

MemberWhat it does
Selection / ActiveCellThe selected range and the active cell
MoveTo(row, col)Moves
SelectionChangedEvent

Bulk operations on the selection are collected in Selection and the Active Cell.

Editing

MemberWhat it does
BeginEdit(initialText) / CancelEdit() / IsEditingStarting and cancelling an edit
GetActiveCellInput() / SetActiveCellInput(text)Input and output for a formula bar
ToggleEditingBold() and friendsFormatting while editing

History

Undo() / Redo() / CanUndo / CanRedo / HistoryChanged. Ctrl+Z and Ctrl+Y are wired up.

Display

MemberWhat it does
Zoom / ZoomChangedThe zoom factor (Ctrl+wheel works too)
SetFreeze(rows, cols)Freeze panes
ShowGridLines / ShowHeaders / ShowOutlinesDisplay toggles
DpiScaleDeviceDpi / 96

Other events

EventWhen
ContextMenuRequestedA right-click. Build the menu on the host side
CellButtonClickedA button cell type was clicked

There is no built-in context menu — handle ContextMenuRequested and build your own (ReoGrid.Studio is the reference implementation). See Events.

Renderer (GDI+ / Direct2D)

MemberWhat it does
RendererThe renderer: GridRenderer.Gdi (default) or GridRenderer.Direct2D
ActiveRendererThe renderer actually drawing — Gdi where Direct2D is unavailable
using System.Drawing.Imaging;
using unvell.ReoGrid.WinForms;

grid.Renderer = GridRenderer.Direct2D;

// Where Direct2D cannot run (no native DLL, no Direct3D device) the control stays on GDI+
if (grid.ActiveRenderer != GridRenderer.Direct2D)
	Console.WriteLine("drawing with GDI+");

Direct2D draws on the GPU and lays text out with DirectWrite. The more cells on screen, the bigger the difference: a full repaint while scrolling is about 3.5× faster than GDI+ (3.6 ms → 1.0 ms per frame in a 1400×900 window).

  • The in-cell editor, auto-fit of column widths and row heights, and text overflow measure text with the same renderer as the grid, so what is measured is what is drawn.
  • Grid lines and borders land on the same pixels as with GDI+ at every scale from 100% to 200%. Text is antialiased by DirectWrite, so it looks slightly different from GDI+.
  • You can switch at run time; a cell being edited stays in edit mode.
  • Printing (CreatePrintDocument) and RenderTo(graphics, …) draw with GDI+ either way.

Requirements and deployment

Runs in an x64 or x86 process (an ARM64 process stays on GDI+). Without a usable GPU it still runs, on Direct3D’s software rasterizer (WARP).

Drawing uses a native DLL that ships in the package:

ProcessFile
x64runtimes/win-x64/native/d2dlib64.dll
x86runtimes/win-x86/native/d2dlib32.dll

With a NuGet reference the SDK copies it into your build and publish output (single-file publish included). If you use the zip from the portal, keep the runtimes folder next to unvell.ReoGrid.One.dll. Without the DLL, setting Renderer to Direct2D still draws with GDI+.

High DPI

Enabling PerMonitorV2 is recommended.

Application.SetHighDpiMode(HighDpiMode.PerMonitorV2);

Windows then hands the control a physical-pixel client area instead of scaling a bitmap, and the control scales its own drawing for a crisp result.

Rendering to an arbitrary Graphics

MemberWhat it does
RenderTo(graphics, width, height, scale)Renders at a logical size you give
RenderFrame(graphics, physicalWidth, physicalHeight)Physical pixels (zoom included)
RenderToBitmap(width, height, scale)Draws into a new Bitmap with the current renderer (ActiveRenderer)

Useful for generating thumbnails or writing images headlessly. None of them needs a window.

// A logical 800×500 view at 1.5× (1200×750 px), drawn by the ActiveRenderer
using var bitmap = grid.RenderToBitmap(800, 500, scale: 1.5f);
bitmap.Save("sheet.png", ImageFormat.Png);

Printing

using var doc = control.CreatePrintDocument();
doc.Print();

It returns a PrintDocument, so you can hand it straight to the standard print dialog or a print preview. See Printing and Page Setup.

Was this article helpful?