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);
                }
  • 相关阅读:
    用 Mac 给树莓派重装系统
    Python:matplotlib 中文乱码的解决方案
    Python: 通过 pip 安装第三方包后依然不能 import
    Python: 安装 sklearn 包出现错误的解决方法
    grub2引导安装kali2.0及安装ibus拼音输入法
    2015移动安全挑战赛 第一题
    Linux kali 3.14-kali1-amd64 编译安装 wine 1.7.33
    git clone https协议问题
    常见问题
    Sieve_of_Eratosthenes
  • 原文地址:https://www.cnblogs.com/zeroone/p/4311117.html
Copyright © 2011-2022 走看看