示例#1
0
        private void GridViewPrint(bool showPreview)
        {
            try
            {
                if (PFSystemObjects.SysInfo.DefaultPrinterIsDefined() == false)
                {
                    _msg.Length = 0;
                    _msg.Append("No default printer specified. You must specify a default printer for print routines to work.");
                    throw new System.Exception(_msg.ToString());
                }

                PFDataGridViewPrinter _dgvPrinter = new PFDataGridViewPrinter();
                InitDataGridViewPrinter(_dgvPrinter);
                if (showPreview)
                {
                    _dgvPrinter.PrintPreview();
                }
                else
                {
                    _dgvPrinter.Print();
                }
            }
            catch (System.Exception ex)
            {
                _msg.Length = 0;
                _msg.Append(AppGlobals.AppMessages.FormatErrorMessage(ex));
                AppMessages.DisplayErrorMessage(_msg.ToString(), _saveErrorMessagesToErrorLog);
            }
            finally
            {
                ;
            }
        }
        private void ShowPrintDialog()
        {
            PFDataGridViewPrinter _dgvPrinter = new PFDataGridViewPrinter();

            InitDataGridViewPrinter(_dgvPrinter);
            _dgvPrinter.Print();
        }
        private void ShowPrintPreview()
        {
            PFDataGridViewPrinter _dgvPrinter = new PFDataGridViewPrinter();

            InitDataGridViewPrinter(_dgvPrinter);
            _dgvPrinter.PrintPreview();
        }
示例#4
0
        private void ShowPageSettings()
        {
            PFDataGridViewPrinter _dgvPrinter = new PFDataGridViewPrinter();

            InitDataGridViewPrinter(_dgvPrinter);
            _dgvPrinter.ShowPageSettingsDialog();
            _savePageSettings = _dgvPrinter.Printer.printDoc.DefaultPageSettings;
        }
示例#5
0
        private void InitDataGridViewPrinter(PFDataGridViewPrinter dgvPrinter)
        {
            dgvPrinter.Grid = this.dataGridAppSettings;

            dgvPrinter.Printer.printDoc.DefaultPageSettings = _savePageSettings;
            dgvPrinter.Printer.printDoc.DefaultPageSettings.PaperSource.RawKind = (int)System.Drawing.Printing.PaperSourceKind.AutomaticFeed;

            dgvPrinter.Title               = AppGlobals.AppInfo.AssemblyDescription;
            dgvPrinter.SubTitle            = "Application Settings for " + Path.GetFileName(Program._exeFileName);
            dgvPrinter.Footer              = AppGlobals.AppInfo.AssemblyProduct;
            dgvPrinter.PageNumbers         = true;
            dgvPrinter.ShowTotalPageNumber = true;
        }
        private void InitDataGridViewPrinter(PFDataGridViewPrinter dgvPrinter)
        {
            dgvPrinter.Grid = this.dataGridAppSettings;

            dgvPrinter.Printer.printDoc.DefaultPageSettings = _savePageSettings;
            dgvPrinter.Printer.printDoc.DefaultPageSettings.PaperSource.RawKind = (int)System.Drawing.Printing.PaperSourceKind.AutomaticFeed;

            dgvPrinter.Title               = "Testprog for DataGridViewPrinter";
            dgvPrinter.SubTitle            = "AppSettings from config file";
            dgvPrinter.Footer              = "ProFast Computing";
            dgvPrinter.PageNumbers         = true;
            dgvPrinter.ShowTotalPageNumber = true;
        }
        private void InitDataGridViewPrinter(PFDataGridViewPrinter dgvPrinter)
        {
            dgvPrinter.Grid = (DataGridView)this.inputDataGrid;

            dgvPrinter.Printer.printDoc.DefaultPageSettings = _savePageSettings;
            dgvPrinter.Printer.printDoc.DefaultPageSettings.PaperSource.RawKind = (int)System.Drawing.Printing.PaperSourceKind.AutomaticFeed;

            dgvPrinter.Title               = AppGlobals.AppInfo.AssemblyDescription;
            dgvPrinter.SubTitle            = "Data output from " + this.DataGridBindingSource.DataMember;
            dgvPrinter.Footer              = AppGlobals.AppInfo.AssemblyProduct;
            dgvPrinter.PageNumbers         = true;
            dgvPrinter.ShowTotalPageNumber = true;
        }