private void PrintPreview(DevExpress.XtraPrinting.IPrintable gridControlPrint) { DevExpress.XtraPrintingLinks.CompositeLink compositeLink = new DevExpress.XtraPrintingLinks.CompositeLink(); DevExpress.XtraPrinting.PrintingSystem ps = new DevExpress.XtraPrinting.PrintingSystem(); //设置左右间距 compositeLink.Margins.Left = 10; compositeLink.Margins.Right = 10; ///设置页眉 PageHeaderFooter phf = compositeLink.PageHeaderFooter as PageHeaderFooter; phf.Header.Content.Clear(); phf.Header.Content.AddRange(new string[] { "", SqlHlperClass.SelectTable("select * from sys_corporation").Rows[0][0]+" " +cmbGS.Text, "" }); phf.Header.LineAlignment = BrickAlignment.Center; phf.Header.Font = new Font("黑体", 22, FontStyle.Bold);
ps.Graph.ForeColor = Color.Red;//.Font = new Font("黑体", 10, FontStyle.Bold); compositeLink.PrintingSystem = ps; compositeLink.Landscape = false; //横向
compositeLink.PaperKind = System.Drawing.Printing.PaperKind.A4; //纸张 DevExpress.XtraPrinting.PrintableComponentLink link = new DevExpress.XtraPrinting.PrintableComponentLink(ps);
ps.PageSettings.Landscape = false; //横向
link.Component = gridControlPrint; compositeLink.Links.Add(link);
// ps.PageSettings.Assign(new Margins(0, 0, 0, 0), new Margins(0, 0, 0, 0), PaperKind.Custom, new Size(300, 400), false);
// ps.PageSettings.RightMargin = 0;
link.CreateDocument(); //建立文档 ps.PreviewFormEx.Show();//进行预览 // ps.Print();
}
优质内容筛选与推荐>>1、ObservableCollection 类
2、JS省市区联动效果
3、Java启动参数及调优
4、文件的操作
5、iOS开发--即时通讯