zoukankan      html  css  js  c++  java
  • DevExpress的GridControl如何实现打印和打印预览 z

    第一种方法:

                System.Drawing.Printing.PageSettings set_print_page = new System.Drawing.Printing.PageSettings();
                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 (DevExpress.XtraPrinting.PrintHelper.IsPrintingAvailable)
                {
                    DataRowView drv = (DataRowView)BS_Roads.Current;
                    PrintingSystem ps = new PrintingSystem();
                    PrintableComponentLink link = new PrintableComponentLink(ps);
                    link.Component = gc;
                    link.Landscape = true;
                    PageHeaderFooter phf = link.PageHeaderFooter as PageHeaderFooter;
                    phf.Header.Content.Clear();
                    phf.Header.Content.AddRange(new string[] { "", drv["线路名"].ToString() + "站点信息表""" });
                    phf.Header.Font = new System.Drawing.Font("宋体"16, System.Drawing.FontStyle.Regular);
                    phf.Header.LineAlignment = BrickAlignment.Center;
                    phf.Footer.Content.Clear();
                    phf.Footer.Content.AddRange(new string[] { "", String.Format("打印时间: {0:g}", DateTime.Now), "" });
                    link.CreateDocument();
                    link.ShowPreview();
                }
                else
                {
                    XtraMessageBox.Show("打印机不可用...""提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
  • 相关阅读:
    觉察——似非而是的隽语
    蔡志忠:带你看宇宙 颠覆你想象!
    宏图:肯恩·威尔伯眼中的法界|《野兽爱智慧》
    《平常禅》的启示:在平凡生活中活出真实的自己|心灵自由写作群·文选
    我们如何从高纬度世界吸取能量?
    刘希彦·到底该如何进补
    胡因梦|修道上的物化倾向
    【宗萨仁波切】精进,并不表示你要多念经、多念咒!
    Mysql:Authentication Plugins:插件式(权限)认证
    Mysql:通过SSH隧道方式实现安全通讯
  • 原文地址:https://www.cnblogs.com/zeroone/p/4311117.html
Copyright © 2011-2022 走看看