//打印
private void btnPrint_Click(object sender, EventArgs e)
{
PrintPreview(this.gridControl1);
}
//自定义打印
private void PrintPreview(DevExpress.XtraPrinting.IPrintable gridControlPrint)
{
DevExpress.XtraPrintingLinks.CompositeLink compositeLink = new DevExpress.XtraPrintingLinks.CompositeLink();
DevExpress.XtraPrinting.PrintingSystem ps = new DevExpress.XtraPrinting.PrintingSystem();
compositeLink.PrintingSystem = ps;
compositeLink.Landscape = true;
compositeLink.PaperKind = System.Drawing.Printing.PaperKind.A4;
DevExpress.XtraPrinting.PrintableComponentLink link = new DevExpress.XtraPrinting.PrintableComponentLink(ps);
ps.PageSettings.Landscape = true;
link.Component = gridControlPrint;
compositeLink.Links.Add(link);
link.CreateDocument(); //建立文档
ps.PreviewFormEx.Show();//进行预览
}
//打印
private void btnPrint_Click(object sender, EventArgs e)
{
PrintPreview(this.gridControl1);
}
//自定义打印
private void PrintPreview(DevExpress.XtraPrinting.IPrintable gridControlPrint)
{
DevExpress.XtraPrintingLinks.CompositeLink compositeLink = new DevExpress.XtraPrintingLinks.CompositeLink();
DevExpress.XtraPrinting.PrintingSystem ps = new DevExpress.XtraPrinting.PrintingSystem(); compositeLink.PrintingSystem = ps;
compositeLink.Landscape = true;
compositeLink.PaperKind = System.Drawing.Printing.PaperKind.A4;
DevExpress.XtraPrinting.PrintableComponentLink link = new DevExpress.XtraPrinting.PrintableComponentLink(ps);
ps.PageSettings.Landscape = true;
link.Component = gridControlPrint;
compositeLink.Links.Add(link); link.CreateDocument(); //建立文档
ps.PreviewFormEx.Show();//进行预览 }