Prints the grid control.
Namespace: DevExpress.XtraGrid
Assembly: DevExpress.XtraGrid.v8.3.dll
Syntax
| Visual Basic |
|---|
Public Sub Print() |
| C# |
|---|
public void Print(); |
Remarks
To verify that the grid control can be printed check the IsPrintingAvailable property's value.
Example
The following example demonstrates how to print a GridControl or show its Print Preivew. To do this, you should use either the Print or ShowPrintPreview methods.
Note |
|---|
| The GridControl can be printed and previewed only if the XtraPrinting Library is available. To verify that printing the Grid is possible, use the IsPrintingAvailable property. |
When printing a Grid, the current print settings will be used to represent a Grid. Note that you can access and change these settings via the GridView.OptionsPrint, BandedGridView.OptionsPrint or CardView.OptionsPrint properties.
| C# | Copy Code |
|---|---|
using DevExpress.XtraGrid;
// ...
private void ShowGridPreview(GridControl grid) {
// Check whether the GridControl can be previewed.
if (!grid.IsPrintingAvailable) {
MessageBox.Show("The 'DevExpress.XtraPrinting.v7.2.dll' is not found", "Error");
return;
}
// Open the Preview window.
grid.ShowPrintPreview();
}
private void PrintGrid(GridControl grid) {
// Check whether the GridControl can be printed.
if (!grid.IsPrintingAvailable) {
MessageBox.Show("The 'DevExpress.XtraPrinting.v7.2.dll' is not found", "Error");
return;
}
// Print.
grid.Print();
}
| |
本文介绍了如何使用 DevExpress Grid 控件进行打印预览及实际打印操作。通过检查 IsPrintingAvailable 属性来验证是否具备打印条件,并展示了如何使用 Print 和 ShowPrintPreview 方法实现网格控件的打印和预览。
Note
Copy Code
1535

被折叠的 条评论
为什么被折叠?



