<!-- Generated by tools/SharpCell.Grid.Docs from the XML documentation comments. Do not edit; run the tool with 'generate'. -->

# IGridCanvas

```csharp
public abstract class IGridCanvas
```

Namespace `SharpCell.Grid` · package `SharpCell.Grid`

What [GridPainter](SharpCell.Grid.GridPainter.md) paints on. Each UI framework implements it over its own drawing API; coordinates are device-independent pixels from the grid's top-left corner.

## Methods

<a id="drawline-double-double-double-double-gridcolor-double-griddash"></a>
### DrawLine(double, double, double, double, GridColor, double, GridDash)

```csharp
public void DrawLine(double x1, double y1, double x2, double y2, GridColor color, double thickness = 1, GridDash dash = GridDash.Solid)
```

Draws a line, centred on the coordinates. One-pixel lines of the grid lie on pixel centres, such as `x = 63.5`.

<a id="drawtext-string-gridrect-gridtextalignment-gridverticalalignment-gridcolor-gridfont-bool"></a>
### DrawText(string, GridRect, GridTextAlignment, GridVerticalAlignment, GridColor, GridFont, bool)

```csharp
public void DrawText(string text, GridRect bounds, GridTextAlignment alignment, GridVerticalAlignment verticalAlignment, GridColor color, GridFont font, bool wrap)
```

Draws text placed inside the bounds and cut off at them: one line, or wrapped onto as many lines as the width needs.

<a id="fillrectangle-gridrect-gridcolor"></a>
### FillRectangle(GridRect, GridColor)

```csharp
public void FillRectangle(GridRect rect, GridColor color)
```

Fills a rectangle.

<a id="strokerectangle-gridrect-gridcolor-double"></a>
### StrokeRectangle(GridRect, GridColor, double)

```csharp
public void StrokeRectangle(GridRect rect, GridColor color, double thickness)
```

Draws the outline of a rectangle, the stroke centred on its edges.
