DrawGrid Method

ControlPaint.DrawGrid Method (Graphics, Rectangle, Size, Color)


Draws a grid of one-pixel dots with the specified spacing, within the specified bounds, on the specified graphics surface, and in the specified color.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public static void DrawGrid(
	Graphics graphics,
	Rectangle area,
	Size pixelsBetweenDots,
	Color backColor


Type: System.Drawing.Graphics

The Graphics to draw on.

Type: System.Drawing.Rectangle

The Rectangle that represents the dimensions of the grid.

Type: System.Drawing.Size

The Size that specified the height and width between the dots of the grid.

Type: System.Drawing.Color

The Color of the background behind the grid.

The backColor parameter is used to calculate the fill color of the dots so that the grid is always visible against the background.

.NET Framework
Available since 1.1
Return to top
© 2016 Microsoft