public void PrintCtrl(PrintScale scaling, Rectangle r, PageSettings ps, bool bitmap, bool preview) { _printScale = scaling; _bitmap = bitmap; _printRect = new RectangleF(r.X, r.Y, r.Width, r.Height); try { PrintDocument pd = new PrintDocument(); pd.PrintPage += new PrintPageEventHandler(this.OnPrintCtrl); if (ps != null) { pd.DefaultPageSettings = ps; pd.PrinterSettings = (_printHandler._printSettings == null) ? ps.PrinterSettings : _printHandler.printSettings; } else { pd.DefaultPageSettings = _printHandler.pageSettings; pd.PrinterSettings = (_printHandler._printSettings == null) ? ps.PrinterSettings : _printHandler.printSettings; } DialogResult dr = DialogResult.OK; if (preview) { ChartPrinter.ChartPreviewDialogEx(pd, _printHandler._usePrintDialog); _printHandler._printSettings = pd.PrinterSettings; } else { if (_printHandler._usePrintDialog) { PrintDialog px = new PrintDialog(); px.Document = pd; dr = px.ShowDialog(); px.Dispose(); } if (dr == DialogResult.OK) { pd.Print(); } } pd.Dispose(); } catch (Exception) {} }
public PrintAllDialog(int[] docIDs, PrintAllFoldersType folderType) { switch (folderType) { case PrintAllFoldersType.WorkFolder: case PrintAllFoldersType.SearchFolder: case PrintAllFoldersType.InquiryFolder: values = new int[docIDs.Length]; docIDs.CopyTo(values, 0); break; case PrintAllFoldersType.ArchivFolder: break; } using ( var dialog = new DocPrintDialog(0, Environment.Settings.Folders.Add("Print"), 0, Environment.StringResources.GetString("Dialog_PrintAllDialog_Title1"))) { if (dialog.ShowDialog() == DialogResult.OK) { printImage = dialog.PrintImage; mainOnly = dialog.PrintOnlyMain; eForm = dialog.PrintEForm; orientation = dialog.Orientation; scaleMode = dialog.ScaleMode; annotations = dialog.Annotations; copiescount = dialog.CopiesCount; prn = new PrinterOp(DocPrintDialog.Printer, this); printerInfo = Environment.Printers.List[DocPrintDialog.Printer] as PrinterInfo ?? prn.GetInfo(); } } if (printImage || eForm) { InitializeComponent(); } else { Load += PrintAllDialog_Load; values = null; return; } InitLayoutProperties(); }
public PrintAllDialog(int[] values) { this.values = values; using ( var dialog = new DocPrintDialog(0, Environment.Settings.Folders.Add("Print"), 0, Environment.StringResources.GetString("Dialog_PrintAllDialog_Title1")) { PrintImage = false }) { if (dialog.ShowDialog() == DialogResult.OK) { printImage = dialog.PrintImage; mainOnly = dialog.PrintOnlyMain; eForm = dialog.PrintEForm; orientation = dialog.Orientation; scaleMode = dialog.ScaleMode; annotations = dialog.Annotations; copiescount = dialog.CopiesCount; prn = new PrinterOp(DocPrintDialog.Printer, this); printerInfo = Environment.Printers.List[DocPrintDialog.Printer] as PrinterInfo ?? prn.GetInfo(); } } if (printImage || eForm) { InitializeComponent(); } else { Load += PrintAllDialog_Load; values = null; return; } InitLayout(); }
/// <summary> /// Creates an instance of ChartPrinter specifying default scaling, default print settings and /// print dialog usage. /// </summary> /// <param name="ctrl">Specifies an instance of a FlexChart control to be drawn to a printer device.</param> /// <param name="scaling">Specifies the scaling to be used to fit the control to the drawing area.</param> /// <param name="ps">Specifies a reference to PrinterSettings to be used.</param> /// <param name="printDialog">A boolean specifying whether a PrintSettings dialog should be displayed.</param> public ChartPrinter(Control ctrl, PrintScale scaling, ref PrinterSettings ps, bool printDialog) { init(ctrl, printDialog); _usePrintDialog = printDialog; _printSettings = ps == null ? new PrinterSettings() : ps; }
/// <summary> /// Creates an instance of ChartPrinter specifying default scaling and print dialog usage. /// </summary> /// <param name="ctrl">Specifies an instance of a FlexChart control to be drawn to a printer device.</param> /// <param name="scaling">Specifies the scaling to be used to fit the control to the drawing area.</param> /// <param name="printDialog">A boolean specifying whether a PrintSettings dialog should be displayed.</param> public ChartPrinter(Control ctrl, PrintScale scaling, bool printDialog) { init(ctrl, printDialog); _usePrintDialog = printDialog; }
/// <summary> /// Prints the control to the page using the specied scaling. The entire page is used as the print rectangle /// for the control scaling. /// </summary> /// <param name="scaling">Specifies the scaling use to fit the control draw to the specified rectangle.</param> public virtual void PrintCtrl(PrintScale scaling) { PrintCtrl(scaling, Rectangle.Empty); }
/// <summary> /// Prints the control to the specified rectangle on the page using the specied scaling. /// </summary> /// <param name="scaling">Specifies the scaling use to fit the control draw to the specified rectangle.</param> /// <param name="r">Specifes the rectangle to draw and fit the control relative to the top, left /// of the page margins. Rectangle.Empty indicates that rectangle specified the by the page margins is /// assumed. If either of the Width or Height of the rectangle is zero, then the entire length betwteen /// the appropriate margins is assumed. /// </param> public virtual void PrintCtrl(PrintScale scaling, Rectangle r) { ctrlPrinter cp = new ctrlPrinter(this, this._ctrl); cp.PrintCtrl(scaling, r); }
/// <summary> /// Prints the control to the specified rectangle on the page using the specied scaling and grayscale. /// </summary> /// <param name="scaling">Specifies the scaling use to fit the control draw to the specified rectangle.</param> /// <param name="r">Specifes the rectangle to draw and fit the control relative to the top, left /// of the page margins. Rectangle.Empty indicates that rectangle specified the by the page margins is /// assumed. If either of the Width or Height of the rectangle is zero, then the entire length betwteen /// the appropriate margins is assumed. /// </param> /// <param name="ps">Specifies predefined a PageSettings object.</param> public virtual void PrintCtrl(PrintScale scaling, Rectangle r, PageSettings ps) { ctrlPrinter cp = new ctrlPrinter(this, this._ctrl); cp.PrintCtrl(scaling, r, ps); }
/// <summary> /// Prints the control to the specified rectangle on the page using the specied scaling and grayscale. /// </summary> /// <param name="scaling">Specifies the scaling use to fit the control draw to the specified rectangle.</param> /// <param name="r">Specifes the rectangle to draw and fit the control relative to the top, left /// of the page margins. Rectangle.Empty indicates that rectangle specified the by the page margins is /// assumed. If either of the Width or Height of the rectangle is zero, then the entire length betwteen /// the appropriate margins is assumed. /// </param> /// <param name="ps">Specifies predefined a PageSettings object.</param> /// <param name="bitmap">If true, specifies that the control is drawn as a bitmap.</param> /// <param name="preview">If true, a PrintPreview dialog is shown instead of drawing to a printer.</param> public virtual void PrintCtrl(PrintScale scaling, Rectangle r, PageSettings ps, bool bitmap, bool preview) { ctrlPrinter cp = new ctrlPrinter(this, this._ctrl); cp.PrintCtrl(scaling, r, ps, bitmap, preview); }
/// <summary> /// Prints the control to the Graphics object defined by the PrintPageEventArgs parameter to /// the specified rectangle on the page using the specied scaling and grayscale specified. /// </summary> /// <param name="printDoc">Specifies the PrintDocument to which the control is drawn.</param> /// <param name="ppea">PrintPageEventArgs as generated through a call to PrintDocument.Print()</param> /// <param name="scaling">Specifies the scaling use to fit the control draw to the specified rectangle.</param> /// <param name="printRect">Specifes the rectangle to draw and fit the control relative to the top, left /// of the MarginBounds as specified in PrintPageEventArgs. Rectangle.Empty indicates that rectangle /// specified the by the MarginBounds is assumed. If either of the Width or Height of the rectangle is zero, /// then the entire page betwteen the appropriate margins is assumed. /// </param> /// <param name="useGrayScale">If true, the control is drawn to size as a bitmap using grayscale.</param> public virtual void PrinterCtrlToPage(PrintDocument printDoc, PrintPageEventArgs ppea, PrintScale scaling, Rectangle printRect, bool useGrayScale) { // Preserve the PrintPageEventArgs GraphicsState gsave = ppea.Graphics.Save(); bool hasMorePages = ppea.HasMorePages; UseGrayScale = useGrayScale; ctrlPrinter cp = new ctrlPrinter(this, this._ctrl); cp.printScale = scaling; cp.printRect = printRect; cp.OnPrintCtrl(printDoc, ppea); // Restore the PrintPageEventArgs ppea.HasMorePages = hasMorePages; ppea.Graphics.Restore(gsave); }
public void PrintCtrl(PrintScale scaling, Rectangle r, PageSettings ps, bool bitmap) { PrintCtrl(scaling, r, ps, bitmap, false); }
public void PrintCtrl(PrintScale scaling, Rectangle r) { PrintCtrl(scaling, r, null); }
public PrintAllDialog(int folderID, int empID, PrintAllFoldersType folderType) { switch (folderType) { case PrintAllFoldersType.WorkFolder: using ( var dt = Environment.DocData.GetWorkFolderDocs(folderID, empID, Environment.CurCultureInfo. TwoLetterISOLanguageName)) { if (dt.Rows.Count > 0) { values = new int[dt.Rows.Count]; for (int i = 0; i < values.Length; i++) { values[i] = (int)dt.Rows[i][Environment.DocData.IDField]; } } else { Load += PrintAllDialog_Load; values = null; return; } dt.Dispose(); } break; case PrintAllFoldersType.ArchivFolder: break; case PrintAllFoldersType.SearchFolder: using ( var dt = Environment.DocData.GetFoundDocs(Environment.CurCultureInfo.Name, empID, Environment.UserSettings.PersonID)) { if (dt.Rows.Count > 0) { values = new int[dt.Rows.Count]; for (int i = 0; i < values.Length; i++) { values[i] = (int)dt.Rows[i][Environment.DocData.IDField]; } } else { Load += PrintAllDialog_Load; values = null; return; } dt.Dispose(); } break; case PrintAllFoldersType.InquiryFolder: string xml = Environment.QueryData.GetField(Environment.QueryData.XMLField, folderID).ToString(); string sql = Data.DALC.Documents.Search.Options.GetSQL(xml); using ( DataTable dt = Environment.DocData.GetQueryDocs(sql, Environment.CurCultureInfo. TwoLetterISOLanguageName, empID, Environment.UserSettings.PersonID)) { if (dt.Rows.Count > 0) { values = new int[dt.Rows.Count]; for (int i = 0; i < values.Length; i++) { values[i] = (int)dt.Rows[i][Environment.DocData.IDField]; } } else { Load += PrintAllDialog_Load; values = null; return; } dt.Dispose(); } break; } using ( var dialog = new DocPrintDialog(0, Environment.Settings.Folders.Add("Print"), values, Environment.StringResources.GetString("Dialog_PrintAllDialog_Title1"))) { if (dialog.ShowDialog() == DialogResult.OK) { printImage = dialog.PrintImage; mainOnly = dialog.PrintOnlyMain; eForm = dialog.PrintEForm; orientation = dialog.Orientation; scaleMode = dialog.ScaleMode; annotations = dialog.Annotations; copiescount = dialog.CopiesCount; prn = new PrinterOp(DocPrintDialog.Printer, this); printerInfo = Environment.Printers.List[DocPrintDialog.Printer] as PrinterInfo ?? prn.GetInfo(); } } if (printImage || eForm) { InitializeComponent(); } else { Load += PrintAllDialog_Load; values = null; return; } InitLayoutProperties(); }