gridcontrol的打印功能的问题。
我使用gridcontrol的打印功能,我想在打印之前隐藏一些数据,打印后再显示出来。代码如下
//打印
private void btnPrint_ItemClick(object sender, ItemClickEventArgs e)
{
if (gc.MainView == gvDepots)
{
this.gvDepots.Bands[2].Visible = false;
this.gvDepots.Bands[4].Visible = false;
}
DevExpress.XtraPrinting.DynamicPrintHelper ph = new DevExpress.XtraPrinting.DynamicPrintHelper();
if (ph.IsPrintingAvailable)
{
ph.PageSettings = set_print_page;
ph.PageSettings.Landscape = true;
ph.ShowPreview(this.gc, true);
}
if (gc.MainView == gvDepots)
{
this.gvDepots.Bands[2].Visible = true;
this.gvDepots.Bands[4].Visible = true;
}
}
这段代码的问题是,打印的时候如果用户修改了某些选项,就会重新加载gridcontrol的数据,就像是没隐藏一样。所以我想做的是捕获这个打印窗体的关闭事件。请问大虾们,如何做到。