zoukankan      html  css  js  c++  java
  • DEV 打印gridcontrl

       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();

            }

  • 相关阅读:
    js属性对象的hasOwnProperty方法
    利用递归的方式在JSON 数据中找到某个节点的多有父节点
    数组中的方法 --- 不改变原数组的方法
    数组中的方法-- 会改变原数组的
    break continue return 的区别
    解决vue中对象属性改变视图不更新的问题
    怎么实现无痛刷新token
    正则的使用记录
    一级域名的登录信息在二级域名中获取
    没有什么问题是不能通过增加一个抽象层解决的
  • 原文地址:https://www.cnblogs.com/jiangu66/p/3192263.html
Copyright © 2011-2022 走看看