DevExpress 打印方法(官方帮助文档推荐的方法)

官方推荐的打印方法,能够满足绝大部分的需求,预览页面需要进一步设置,功能还是蛮强大的。

步骤:

1、界面拖一个button按钮,为按钮设置单击事件

2、单击事件填写代码,调用下面方法即可,非常简单,剩下的就是在预览页面中设置了,GridControl控件在设计页面有个PrintSetting项目可以详细设置。

private void ShowGridPreview(DevExpress.XtraGrid.GridControl grid)
{
// Check whether the XtraGrid control can be previewed. if(!grid.IsPrintingAvailable) { MessageBox.Show("The 'DevExpress.XtraPrinting' Library is not found", "Error"); return; } // Opens the Preview window. grid.ShowPreview(); }

posted on 2016-11-10 10:30  Real520  阅读(773)  评论(0编辑  收藏  举报

导航