1. 通用的GridControl.mmPrint打印方法,调用Dev本身的PrintableComponentLink组件 

   

        public void mmPrint()
        {
            using (DevExpress.XtraPrinting.PrintableComponentLink vPrintComp1 = new DevExpress.XtraPrinting.PrintableComponentLink(new PrintingSystem()))
            {
                vPrintComp1.Component = this;
                vPrintComp1.Landscape = true;
                vPrintComp1.PaperKind = this._mpPrintPaperKind;
                vPrintComp1.CreateMarginalHeaderArea += this.myEvent_CreateMarginalHeaderArea;
                //vPrintComp1.Margins.Left / .Top 
                vPrintComp1.CreateDocument();
                vPrintComp1.ShowPreview();
            }
        }

   

   2. 打印格式事件CreateMarginalHeaderArea:

 1         private void myEvent_CreateMarginalHeaderArea(object sender, CreateAreaEventArgs e)
 2         {
 3             string vReportTitle = this.FindForm().Text.Trim().mmGetSplitLeftString("[");
 4             PageInfoBrick vPageInfoBrick1 = e.Graph.DrawPageInfo(PageInfo.None, vReportTitle, Color.DarkBlue,
 5                new RectangleF(0, 0, 100, 21), BorderSide.None);
 6             vPageInfoBrick1.LineAlignment = BrickAlignment.Center;
 7             vPageInfoBrick1.Alignment = BrickAlignment.Center;
 8             vPageInfoBrick1.AutoWidth = true;
 9             vPageInfoBrick1.Font = new System.Drawing.Font("宋体", 11f, FontStyle.Bold);
10         }

相关文章:

  • 2022-02-28
  • 2022-12-23
  • 2022-12-23
  • 2022-03-04
  • 2021-12-06
  • 2022-12-23
  • 2021-11-17
猜你喜欢
  • 2021-05-17
  • 2022-12-23
  • 2022-01-02
  • 2021-11-07
  • 2022-12-23
  • 2021-06-22
  • 2022-12-23
相关资源
相似解决方案