Print() in grid

本文介绍了如何使用 DevExpress Grid 控件进行打印预览及实际打印操作。通过检查 IsPrintingAvailable 属性来验证是否具备打印条件,并展示了如何使用 Print 和 ShowPrintPreview 方法实现网格控件的打印和预览。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Prints the grid control.

Namespace: DevExpress.XtraGrid
Assembly: DevExpress.XtraGrid.v8.3.dll

Collapse imageSyntax

Visual Basic
Public Sub Print()
C#
public void Print();

Collapse imageRemarks

To verify that the grid control can be printed check the IsPrintingAvailable property's value.

Collapse imageExample

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.

NoteNote

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#CopyCode imageCopy 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();
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值