DataGridViewExtensionsGetPrintDocument Method

Generates a PrintDocument object for printing the contents of the source DataGridView.

Definition

Namespace: DevCase.Extensions.DataGridViewExtensions
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static PrintDocument GetPrintDocument(
	this DataGridView dataGridView,
	string title = null,
	Font textFont = null,
	Color headerBackColor = default,
	Color headerForeColor = default,
	Color rowBackColor = default,
	Color rowForeColor = default,
	Color rowBackColorAlternate = default,
	Color rowForeColorAlternate = default
)

Parameters

dataGridView  DataGridView
The DataGridView to print.
title  String  (Optional)
The title to be printed at the top of the document.

If not provided, the Name property value will be used as the title.

textFont  Font  (Optional)
Optional. The font to draw header and row texts.

If not provided, the Font property value will be used as the text font.

headerBackColor  Color  (Optional)
Optional. The background color of the header row.

If not provided, the default color is White.

headerForeColor  Color  (Optional)
Optional. The text color of the header row.

If not provided, the default color is Black.

rowBackColor  Color  (Optional)
Optional. The background color of the data rows.

If not provided, the default color is White.

rowForeColor  Color  (Optional)
Optional. The text color of the data rows.

If not provided, the default color is Black.

rowBackColorAlternate  Color  (Optional)
Optional. The background color of the alternate data rows.

If not provided, the default color is White.

rowForeColorAlternate  Color  (Optional)
Optional. text color of the alternate data rows.

If not provided, the default color is Black.

Return Value

PrintDocument
A PrintDocument object for printing the contents of the source DataGridView.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DataGridView. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Example

This is a code example.
C#
No code example is currently available or this language may not be supported.

See Also