Esempio n. 1
0
        public XPaperSize Add(System.Drawing.Printing.PaperKind vKind, int vWidth, int vHeight)
        {
            XPaperSize size = new XPaperSize(vKind, vWidth, vHeight);

            this.List.Add(size);
            return(size);
        }
Esempio n. 2
0
 public XPaperSize this[System.Drawing.Printing.PaperKind vKind]
 {
     get
     {
         foreach (XPaperSize size in this.List)
         {
             if (size.Kind == vKind)
             {
                 return(size);
             }
         }
         return(null);
     }
 }
Esempio n. 3
0
        public void PaperKind(System.Drawing.Printing.PaperKind paperKind)
        {
            try
            {
                richEdit.Document.Sections[0].Page.PaperKind = paperKind;
                richEdit.Document.Sections[0].Page.Landscape = false;
                richEdit.Document.Sections[0].Margins.Left   = 0;

                richEdit.ActiveViewType        = DevExpress.XtraRichEdit.RichEditViewType.Draft;
                richEdit.ActiveView.ZoomFactor = 1.0f;

                return;
            }
            catch (Exception ex)
            {
                ExceptionBox.Show(ex);
                return;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 文档预览...
        /// </summary>
        public void PrintPreview(DIYReport.ReportModel.RptReport dataReport)
        {
            string sessionName = getSessionName(dataReport);;

            SetPrintPageInfo(dataReport);
            string pagerName = IniFile.ReadString(sessionName, "PaperName", printingSystem.PageSettings.PaperName, DIY_REPORT_CFG_FILE);

            if (pagerName == null || pagerName.Length == 0)
            {
                pagerName = printingSystem.PageSettings.PaperName;
            }

            DevExpress.XtraPrinting.Link link = CreateLinkDoc(pagerName, dataReport);

            readPageSetting(dataReport, link);

            try{
                //System.Windows.Forms.MessageBox.Show("当前PageName" + pagerName);
                string kindName = IniFile.ReadString(sessionName, "PaperKind", printingSystem.PageSettings.PaperKind.ToString(), DIY_REPORT_CFG_FILE);
                System.Drawing.Printing.PaperKind pKind = (System.Drawing.Printing.PaperKind)Enum.Parse(typeof(System.Drawing.Printing.PaperKind), kindName, true);
                link.PrintingSystem.PageSettings.PaperKind = pKind;
            }
            catch {}

            link.Landscape = printingSystem.PageSettings.Landscape;
            link.PaperKind = link.PrintingSystem.PageSettings.PaperKind;
            //link.PrintingSystem.PageSettings.PaperName = pagerName;
            link.ShowPreviewDialog();
            // link.ShowRibbonPreview(DevExpress.LookAndFeel.UserLookAndFeel.Default);

            savePageSetting(dataReport, link.Margins, link.PrintingSystem.PageSettings.PaperName, link.PaperKind.ToString());

            //System.Windows.Forms.MessageBox.Show(printingSystem.PageSettings.LeftMargin.ToString());
//			if(_DrawObj!=null)
//				_DrawObj.Dispose();
            //也可以用下面的方法来实现。
//			DevExpress.XtraPrinting.Preview.PrintPreviewForm frm = new DevExpress.XtraPrinting.Preview.PrintPreviewForm();
//			frm.PrintingSystem = this.PrintingSystem;
//
//			link.CreateDocument();
//			frm.ShowDialog();
        }
Esempio n. 5
0
        /// <summary>
        /// 打印..
        /// </summary>
        public void Print(DIYReport.ReportModel.RptReport dataReport)
        {
            string sessionName = getSessionName(dataReport);;

            SetPrintPageInfo(dataReport);
            string pagerName = IniFile.ReadString(sessionName, "PaperName", printingSystem.PageSettings.PaperName, DIY_REPORT_CFG_FILE);

            if (pagerName == null || pagerName.Length == 0)
            {
                pagerName = printingSystem.PageSettings.PaperName;
            }

            DevExpress.XtraPrinting.Link link = CreateLinkDoc(pagerName, dataReport);

            readPageSetting(dataReport, link);

            try {
                //System.Windows.Forms.MessageBox.Show("当前PageName" + pagerName);
                string kindName = IniFile.ReadString(sessionName, "PaperKind", printingSystem.PageSettings.PaperKind.ToString(), DIY_REPORT_CFG_FILE);
                System.Drawing.Printing.PaperKind pKind = (System.Drawing.Printing.PaperKind)Enum.Parse(typeof(System.Drawing.Printing.PaperKind), kindName, true);
                link.PrintingSystem.PageSettings.PaperKind = pKind;
            }
            catch { }

            link.Landscape = printingSystem.PageSettings.Landscape;
            link.PaperKind = link.PrintingSystem.PageSettings.PaperKind;

            var existsPrinter = DIYReport.Common.EnumPrintersHelperEx.CheckExistsPrinter(dataReport.PrintName);

            if (existsPrinter)
            {
                link.Print(dataReport.PrintName);
            }
            else
            {
                link.PrintDlg();
            }
//			if(_DrawObj!=null)
//				_DrawObj.Dispose();
        }
Esempio n. 6
0
        /// <summary>
        /// 设置编辑器的页面设置,APPCFG中PageSetting参数 by ukey 2018-10-14
        /// </summary>
        /// <param name="kind">纸张类型</param>
        /// <param name="pagersize">纸张大小</param>
        /// <param name="margins">页边距</param>
        public void SetPageSetting(System.Drawing.Printing.PaperKind kind, System.Drawing.Printing.PaperSize pagersize, System.Drawing.Printing.Margins margins)
        {
            string config = GetConfigValueByKey("PageSetting");

            System.Xml.XmlDocument doc = new XmlDocument();
            doc.LoadXml(config);
            XmlNode    pagesetting = doc.ChildNodes[0].SelectSingleNode("pagesettings");
            XmlElement ele         = (pagesetting as XmlElement).SelectSingleNode("page") as XmlElement;

            ele.SetAttribute("kind", kind.ToString());
            ele.SetAttribute("width", pagersize.Width.ToString());
            ele.SetAttribute("height", pagersize.Height.ToString());
            ele = (pagesetting as XmlElement).SelectSingleNode("margins") as XmlElement;
            ele.SetAttribute("left", margins.Left.ToString());
            ele.SetAttribute("top", margins.Top.ToString());
            ele.SetAttribute("right", margins.Right.ToString());
            ele.SetAttribute("bottom", margins.Bottom.ToString());
            config = doc.InnerXml;
            string sql = " update appcfg set value = '{0}' where configkey = 'PageSetting'; ";

            m_app.SqlHelper.ExecuteNoneQuery(string.Format(sql, config), CommandType.Text);
        }
Esempio n. 7
0
        public System.Drawing.Printing.PaperSize Paper(System.Drawing.Printing.PrintDocument document, System.Drawing.Printing.PaperKind paperKind)
        {
            System.Drawing.Printing.PaperSize paper = null;

            foreach (System.Drawing.Printing.PaperSize paperSize in document.PrinterSettings.PaperSizes)
            {
                if (paperSize.Kind.Equals(paperKind))
                {
                    paper = paperSize;
                    break;
                }
            }

            return(paper);
        }
Esempio n. 8
0
        public static void XemVaIn(this DevExpress.XtraGrid.GridControl grid, DevExpress.XtraReports.UI.XtraReport rpt, System.Drawing.Printing.PaperKind PageKind, bool Landscape)
        {
            #region Thiết kế trước khi in

            if (grid != null)
            {
                DevExpress.XtraGrid.Views.Grid.GridView view = grid.MainView as DevExpress.XtraGrid.Views.Grid.GridView;

                if (view != null)
                {
                    view.AppearancePrint.EvenRow.Font                       = new System.Drawing.Font("Times New Roman", 11F);
                    view.AppearancePrint.EvenRow.Options.UseFont            = true;
                    view.AppearancePrint.FilterPanel.Font                   = new System.Drawing.Font("Times New Roman", 11F);
                    view.AppearancePrint.FilterPanel.Options.UseFont        = true;
                    view.AppearancePrint.FooterPanel.BorderColor            = System.Drawing.Color.Black;
                    view.AppearancePrint.FooterPanel.Font                   = new System.Drawing.Font("Times New Roman", 11F);
                    view.AppearancePrint.FooterPanel.Options.UseBorderColor = true;
                    view.AppearancePrint.FooterPanel.Options.UseFont        = true;
                    view.AppearancePrint.GroupFooter.BorderColor            = System.Drawing.Color.Black;
                    view.AppearancePrint.GroupFooter.Font                   = new System.Drawing.Font("Times New Roman", 11F);
                    view.AppearancePrint.GroupFooter.Options.UseBorderColor = true;
                    view.AppearancePrint.GroupFooter.Options.UseFont        = true;
                    view.AppearancePrint.GroupRow.BorderColor               = System.Drawing.Color.Black;
                    view.AppearancePrint.GroupRow.Font                      = new System.Drawing.Font("Times New Roman", 11F, System.Drawing.FontStyle.Bold);
                    view.AppearancePrint.GroupRow.Options.UseBorderColor    = true;
                    view.AppearancePrint.GroupRow.Options.UseFont           = true;
                    view.AppearancePrint.HeaderPanel.BorderColor            = System.Drawing.Color.Black;
                    view.AppearancePrint.HeaderPanel.Font                   = new System.Drawing.Font("Times New Roman", 11F, System.Drawing.FontStyle.Bold);
                    view.AppearancePrint.HeaderPanel.Options.UseBorderColor = true;
                    view.AppearancePrint.HeaderPanel.Options.UseFont        = true;
                    view.AppearancePrint.HeaderPanel.Options.UseTextOptions = true;
                    view.AppearancePrint.HeaderPanel.Options.UseBackColor   = true;
                    view.AppearancePrint.HeaderPanel.BackColor              = System.Drawing.Color.FromArgb(192, 255, 255);
                    view.AppearancePrint.HeaderPanel.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                    view.AppearancePrint.HeaderPanel.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
                    view.AppearancePrint.Lines.BackColor                    = System.Drawing.Color.Black;
                    view.AppearancePrint.Lines.Font = new System.Drawing.Font("Times New Roman", 11F);
                    view.AppearancePrint.Lines.Options.UseBackColor = true;
                    view.AppearancePrint.Lines.Options.UseFont      = true;
                    view.AppearancePrint.OddRow.Font             = new System.Drawing.Font("Times New Roman", 11F);
                    view.AppearancePrint.OddRow.Options.UseFont  = true;
                    view.AppearancePrint.Preview.Font            = new System.Drawing.Font("Times New Roman", 11F);
                    view.AppearancePrint.Preview.Options.UseFont = true;
                    view.AppearancePrint.Row.BorderColor         = System.Drawing.Color.Black;
                    view.AppearancePrint.Row.Font = new System.Drawing.Font("Times New Roman", 11F);
                    view.AppearancePrint.Row.Options.UseBorderColor = true;
                    view.AppearancePrint.Row.Options.UseFont        = true;

                    view.AppearancePrint.EvenRow.BackColor    = System.Drawing.Color.MintCream;
                    view.OptionsPrint.EnableAppearanceEvenRow = true;
                }
            }

            #endregion Thiết kế trước khi in

            rpt.PaperKind = PageKind;
            rpt.Landscape = Landscape;
            rpt.Bands[DevExpress.XtraReports.UI.BandKind.Detail].Controls.Add(CopyGridControl(grid));

            rpt.ShowPreview();
        }
Esempio n. 9
0
 public XPaperSize(System.Drawing.Printing.PaperKind vKind, int vWidth, int vHeight)
 {
     intKind   = vKind;
     intWidth  = vWidth;
     intHeight = vHeight;
 }
Esempio n. 10
0
        public ProductBarcode(DataSet ds)
        {
            DevExpress.XtraPrinting.PrintingSystem printSys = new DevExpress.XtraPrinting.PrintingSystem();
            this.paperKind = printSys.PageSettings.PaperKind;
            this.widthPage = printSys.PageBounds.Width;
            this.heightPage = printSys.PageBounds.Height;
            this.marginLeft = printSys.PageMargins.Left;
            this.marginRight = printSys.PageMargins.Right;
            this.marginTop = printSys.PageMargins.Top;
            this.marginBottom = printSys.PageMargins.Bottom;

            this.fieldId = "ID";
            this.fieldName = "NAME";
            this.fieldUnit = "UNIT";
            this.fieldQuantity = "QUANTITY";
            this.fieldPrice = "PRICE";

            this.dsProduct = ds;

            //this.spaceCol = 10;
            //this.spaceRow = 10;

            this.spaceCol = 0;
            this.spaceRow = 0;

            this.moduleBarcode = 1F;

            this.borderStamp = 1;

            this.heightUnit = 20;
            this.heightName = 20;
            this.heightPrice = 20;
            this.fontUnit = new Font("Tahoma", 8);
            this.fontName = new Font("Tahoma", 8);
            this.fontPrice = new Font("Tahoma", 8);

            this.symBC = BarCodeType.EAN13;
        }