示例#1
0
        private void printDocument_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            StreamReader  textReader = null;
            string        line       = string.Empty;
            StringBuilder tempBuffer = new StringBuilder( );

            pageNumber = 0;

            try
            {
                textReader = new StreamReader(@"c:\temp\tmpfile.txt");

                while ((line = textReader.ReadLine( )) != null)
                {
                    tempBuffer.Append(line);
                    tempBuffer.Append("\n");
                }
                buffer = tempBuffer.ToString( );
            }
            finally
            {
                if (textReader != null)
                {
                    textReader.Close( );
                }
            }
        }
示例#2
0
        /// <summary>
        /// Performs processing when printing begins</summary>
        /// <param name="e">Event args</param>
        protected override void OnBeginPrint(PrintEventArgs e)
        {
            base.OnBeginPrint(e);
            m_font = new Font("Courier", 10);

            if (m_fileName != null)
            {
                try
                {
                    m_streamReader = new StreamReader(m_fileName);
                }
                catch (FileNotFoundException)
                {
                    e.Cancel = true;
                }
            }
            else if (m_stream != null)
            {
                m_streamReader = new StreamReader(m_stream);

            }
            else
                e.Cancel = true;

        }
示例#3
0
        public override void OnStartPrint(PrintDocument document, PrintEventArgs e) {
            Debug.Assert(dc == null && graphics == null, "PrintController methods called in the wrong order?");

            // For security purposes, don't assume our public methods methods are called in any particular order
            CheckSecurity(document);

            base.OnStartPrint(document, e);
            // the win32 methods below SuppressUnmanagedCodeAttributes so assertin on UnmanagedCodePermission is redundant
            if (!document.PrinterSettings.IsValid)
                throw new InvalidPrinterException(document.PrinterSettings);

            dc = document.PrinterSettings.CreateDeviceContext(modeHandle);
            SafeNativeMethods.DOCINFO info = new SafeNativeMethods.DOCINFO();
            info.lpszDocName = document.DocumentName;
            if (document.PrinterSettings.PrintToFile)
                info.lpszOutput = document.PrinterSettings.OutputPort; //This will be "FILE:"
            else
                info.lpszOutput = null;
            info.lpszDatatype = null;
            info.fwType = 0;

            int result = SafeNativeMethods.StartDoc(new HandleRef(this.dc, dc.Hdc), info);
            if (result <= 0) {
                int error = Marshal.GetLastWin32Error();
                if (error == SafeNativeMethods.ERROR_CANCELLED) {
                    e.Cancel = true;
                }
                else {
                    throw new Win32Exception(error);
                }
            }
        }
示例#4
0
/// <summary>
/// Override the default onbeginPrint method of the PrintDocument Object
/// </summary>
/// <param name=e></param>
/// <remarks></remarks>
        protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
        {
            // Run base code
            base.OnBeginPrint(e);

            //Check to see if the user provided a font
            //if they didn't then we default to Times New Roman
            if (Title_font == null)
            {
                //Create the font we need
                Title_font = new Font("ARIAL", 14, FontStyle.Bold);
            }
            if (Addresse_font == null)
            {
                Addresse_font = new Font("ARIAL", 11, FontStyle.Regular);
            }
            if (Bestellung_font == null)
            {
                Bestellung_font = new Font("ARIAL", 12, FontStyle.Bold);
            }
            if (KundenDaten_font == null)
            {
                KundenDaten_font = new Font("Times New Roman", 12, FontStyle.Bold);
            }
            if (Text_font == null)
            {
                Text_font = new Font("Times New Roman", 12, FontStyle.Regular);
            }
        }
示例#5
0
 private void xrTableCell10_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     //if (string.IsNullOrEmpty((sender as XRLabel).Text))
     //    (sender as XRTableCell).Borders = DevExpress.XtraPrinting.BorderSide.Left;
     //else
     //    (sender as XRTableCell).Borders = DevExpress.XtraPrinting.BorderSide.All;
 }
 private void InformeVentasPorPoblacion_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     this.GroupHeader1.Controls.Add(EncabezadoMesesXRTable());
     this.GroupHeader1.Controls.Add(EncabezadoPzasImporteXRTable());
     this.Detail.Controls.Add(DetalleVentaXRTable());
     PageWidth = 670 + (120 * (1 + Math.Abs((Convert.ToDateTime(FechaInicial.Value).Month - Convert.ToDateTime(FechaFinal.Value).Month) + 12 * (Convert.ToDateTime(FechaInicial.Value).Year - Convert.ToDateTime(FechaFinal.Value).Year))));
 }
示例#7
0
 private void printDocument1_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     if (this.radioButton1.Checked || this.radioButton3.Checked)
     {
         this.printDocument1.DefaultPageSettings.Landscape = false;
         foreach (PaperSize ps in this.printDocument1.PrinterSettings.PaperSizes)
         {
             if (ps.PaperName == "A4")
             {
                 this.printDocument1.DefaultPageSettings.PaperSize = ps;
                 break;
             }
         }
     }
     else
     {
         this.printDocument1.DefaultPageSettings.Landscape = true;
         foreach (PaperSize ps in this.printDocument1.PrinterSettings.PaperSizes)
         {
             if (ps.PaperName == "A3")
             {
                 this.printDocument1.DefaultPageSettings.PaperSize = ps;
                 break;
             }
         }
     }
     ((clsControlDeptDocWorkLoadNew)this.objController).m_mthBeginPrint(this.StrFlag);
 }
示例#8
0
 private void m_PrintDocument_EndPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     if (this.PrintAfter != null)
     {
         this.PrintAfter(this, new PrintEventArgs(this.m_PrintDocument));
     }
 }
示例#9
0
文件: Printing.cs 项目: mnisl/OD
        public override void OnEndPrint(PrintDocument document, PrintEventArgs e)
        {
            base.OnEndPrint(document, e);
            document.PrinterSettings.PrintToFile = _isPrintToFile;

            if (ShowAfterPrint)
                System.Diagnostics.Process.Start(this.FileName);

            Document doc = new Document();
            doc.DateCreated = File.GetLastWriteTime(this.FileName);
            if (_sit == PrintSituation.Claim)
            {
                doc.DocCategory = DefC.GetByExactName(DefCat.ImageCats, "EClaims");
                if (doc.DocCategory == 0)
                {
                    Def d = new Def() { Category = DefCat.ImageCats, ItemName = "EClaims" };
                    doc.DocCategory = Defs.Insert(d);
                    DataValid.SetInvalid(InvalidType.Defs);
                }
            }
            else
            {
                doc.DocCategory = DefC.GetList(DefCat.ImageCats)[0].DefNum;//First category.
            }
            doc.FileName = Path.GetFileName(this.FileName);
            doc.Description = doc.FileName;
            doc.PatNum = _patient.PatNum;
            Documents.Insert(doc);
        }
示例#10
0
 private void m_mthBeginPrint(System.Drawing.Printing.PrintEventArgs e)
 {
     if (m_evtBeginPrint != null)
     {
         m_evtBeginPrint(this, e);
     }
 }
示例#11
0
/// <summary>
/// Override the default onbeginPrint method of the PrintDocument Object
/// </summary>
/// <param name=e></param>
/// <remarks></remarks>
        protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
        {
            // Run base code
            base.OnBeginPrint(e);

            //Check to see if the user provided a font
            //if they didn't then we default to Times New Roman
            if (TitleHead_font == null)
            {
                //Create the font we need
                TitleHead_font = new Font("New Times Roman", 18, FontStyle.Bold);
            }
            if (Title_font == null)
            {
                Title_font = new Font("ARIAL", 16, FontStyle.Bold);
            }
            if (Date_font == null)
            {
                Date_font = new Font("ARIAL", 12, FontStyle.Bold);
            }
            if (PrintDate_font == null)
            {
                PrintDate_font = new Font("Times New Roman", 11, FontStyle.Regular);
            }
            if (Text_font == null)
            {
                Text_font = new Font("Times New Roman", 12, FontStyle.Regular);
            }
            if (Text_font_bold == null)
            {
                Text_font_bold = new Font("Times New Roman", 12, FontStyle.Bold);
            }
        }
 public override void OnEndPrint(PrintDocument document, PrintEventArgs e)
 {
     this.CheckSecurity();
     this.dc.Dispose();
     this.dc = null;
     base.OnEndPrint(document, e);
 }
        protected override void OnBeginPrint(PrintEventArgs e)
        {
            base.OnBeginPrint(e);

            if (m_InkFriendlyMode)
            {
                m_HeaderTextBrush = new SolidBrush(Color.Black);
                m_HeaderBackgroundBrush = new SolidBrush(Color.White);

                m_BorderPen = new Pen(Color.DarkGray, 3);
                m_BackgroundBrush = new SolidBrush(Color.White);

                m_WorkoutDetailsBrush = new SolidBrush(Color.Black);
            }
            else
            {
                m_HeaderTextBrush = new SolidBrush(Color.White);
                m_HeaderBackgroundBrush = new SolidBrush(Color.Black);

                m_BorderPen = new Pen(Color.Black, 3);
                m_BackgroundBrush = new SolidBrush(Color.LightGray);

                m_WorkoutDetailsBrush = new SolidBrush(Color.Black);
            }

            m_HeaderFont = new Font(FontFamily.GenericSansSerif, 16, FontStyle.Bold);
            m_HeaderNotesFont = new Font(FontFamily.GenericSansSerif, 10);
            m_WorkoutDetailsFont = new Font(FontFamily.GenericSansSerif, 10);
            m_StepHeaderFont = new Font(FontFamily.GenericSansSerif, 12, FontStyle.Bold);
        }
示例#14
0
 private void xrLabel14_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     //if (GetCurrentColumnValue("status").ToString() == "0")
     //    (sender as XRLabel).Text = "All";
     //else
     //    (sender as XRLabel).Text = "Renew";
 }
示例#15
0
 private void xrTableCell18_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     if ((sender as XRTableCell).Text.ToLower() == "false")
     {
         (sender as XRTableCell).Text = " ";
     }
 }
示例#16
0
        public override void OnStartPrint(PrintDocument document, PrintEventArgs e) {
            Debug.Assert(dc == null && graphics == null, "PrintController methods called in the wrong order?");

            // For security purposes, don't assume our public methods methods are called in any particular order
            CheckSecurity();

            base.OnStartPrint(document, e);

            
            try {
                
                if (!document.PrinterSettings.IsValid)
                throw new InvalidPrinterException(document.PrinterSettings);

                IntSecurity.AllPrintingAndUnmanagedCode.Assert();
                
                // We need a DC as a reference; we don't actually draw on it.
                // We make sure to reuse the same one to improve performance.
                dc = document.PrinterSettings.CreateInformationContext(modeHandle);
            }
            finally {
                CodeAccessPermission.RevertAssert();
            }
            
        }
示例#17
0
        /// <summary>
        /// BeginPrint event handler
        /// </summary>
        /// <param name="e">PrintEventArgs object</param>
        protected override void OnBeginPrint(PrintEventArgs e)
        {
            base.OnBeginPrint(e);
            cardsPrinted = 0;
            dispQsos = qsos.GetDispQsosList(QslCard);
            if(PrinterSettings == null || QslCard == null)
            {
                App.Logger.Log("Programming error: Attempting to print cards before " +
                               "CardPrintDocument.PrintProperties or CardPrintDocument" +
                               ".QslCard is initialized.");
                MessageBox.Show("Programming Error: Please log a bug report and include " +
                                "the contents of the log file", "Programming Error",
                                MessageBoxButton.OK, MessageBoxImage.Error);
                e.Cancel = true;
                return;
            }
            this.DocumentName = "Qsl Cards";
            PrinterSettings settings = new PrinterSettings();
            settings.PrinterName = PrintProperties.PrinterName;
            settings.DefaultPageSettings.PaperSize = PrintProperties.PrinterPaperSize;
            settings.DefaultPageSettings.PrinterResolution = PrintProperties.Resolution;
            settings.DefaultPageSettings.PaperSource = PrintProperties.Source;
            if(PrintProperties.Layout == PrintProperties.CardLayouts.LandscapeTopLeft ||
               PrintProperties.Layout == PrintProperties.CardLayouts.LandscapeTopCenter ||
               PrintProperties.Layout == PrintProperties.CardLayouts.LandscapeCenter)
            {
                settings.DefaultPageSettings.Landscape = true;
            }
            this.PrinterSettings = settings;

            CalculateCardsPerPage();
            CalculateOffsets();
        }
 public override void OnStartPrint(PrintDocument document, PrintEventArgs e)
 {
     base.OnStartPrint(document, e);
     this.document = document;
     this.pageNumber = 1;
     if (SystemInformation.UserInteractive)
     {
         this.backgroundThread = new BackgroundThread(this);
     }
     try
     {
         this.underlyingController.OnStartPrint(document, e);
     }
     catch
     {
         if (this.backgroundThread != null)
         {
             this.backgroundThread.Stop();
         }
         throw;
     }
     finally
     {
         if ((this.backgroundThread != null) && this.backgroundThread.canceled)
         {
             e.Cancel = true;
         }
     }
 }
示例#19
0
        private void Control_BeginPrint(object sender, sdp.PrintEventArgs e)
        {
            _currentPage = 0;
            Callback.OnPrinting(Widget, e);

            _preferredSize = _control?.GetPreferredSize() ?? SizeF.Empty;
        }
示例#20
0
            private void _printDocument_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
            {
                try
                {
                    strFormat               = new StringFormat();
                    strFormat.Alignment     = StringAlignment.Center;
                    strFormat.LineAlignment = StringAlignment.Center;
                    strFormat.Trimming      = StringTrimming.EllipsisCharacter;

                    arrColumnLefts.Clear();
                    arrColumnWidths.Clear();
                    iCellHeight = 0;
                    iRow        = 0;
                    bFirstPage  = true;
                    bNewPage    = true;

                    // Calculating Total Widths
                    iTotalWidth = 0;
                    foreach (DataGridViewColumn dgvGridCol in gw.Columns)
                    {
                        iTotalWidth += dgvGridCol.Width;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
示例#21
0
 private void Document_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     if (e.PrintAction == PrintAction.PrintToPrinter)
     {
         sender = pdfviewer.PrintDocument;
     }
 }
示例#22
0
                protected override void OnBeginPrint(PrintEventArgs e)
                {
                        this.DocumentName = Sheet.Name.Replace(":", "");
                        this.PageNumber = 0;

                        base.OnBeginPrint(e);
                }
 protected override void OnBeginPrint(PrintEventArgs ev)
 {
     base.OnBeginPrint(ev);
       if (this.fntPrintFont != null)
     return;
       this.fntPrintFont = new Font("Times New Roman", 12f);
 }
示例#24
0
        private void OnBeginPrint(object sender,
                                  System.Drawing.Printing.PrintEventArgs e)
        {
            char[] param = { '\n' };

            linesPrinted = 0;
            lines        = null;

            if (printDialog1.PrinterSettings.PrintRange == PrintRange.Selection)
            {
                lines = rtbArmylist.SelectedText.Split(param);
            }
            else
            {
                lines = rtbArmylist.Text.Split(param);
            }

            int i = 0;

            char[] trimParam = { '\r' };
            foreach (string s in lines)
            {
                lines[i++] = s.TrimEnd(trimParam);
            }
        }
示例#25
0
 private void printDocument1_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     this.Cursor = Cursors.WaitCursor;
     if (this.radioButton1.Checked || this.radioButton3.Checked)
     {
         //this.printDocument1.DefaultPageSettings.Landscape=false;
         foreach (PaperSize ps in this.printDocument1.PrinterSettings.PaperSizes)
         {
             if (ps.PaperName == "A4")
             {
                 this.printDocument1.DefaultPageSettings.PaperSize = ps;
                 break;
             }
         }
     }
     else
     {
         //this.printDocument1.DefaultPageSettings.Landscape=true;
         foreach (PaperSize ps in this.printDocument1.PrinterSettings.PaperSizes)
         {
             if (ps.PaperName == "A3")
             {
                 this.printDocument1.DefaultPageSettings.PaperSize = ps;
                 break;
             }
         }
     }
     ((clsCtl_DoctorWorkLoadReport)this.objController).m_mthBeginPrint();
 }
示例#26
0
 void Document_EndPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     this.printPreviewControl1.StartPage = 0;
     this.integerTextBox3.IntegerValue   = 1;
     this.label9.Text = "/" + noOfPages.ToString();
     this.checkButtons();
 }
        /// <include file='doc\PrintControllerWithStatusDialog.uex' path='docs/doc[@for="PrintControllerWithStatusDialog.OnStartPrint"]/*' />
        /// <internalonly/>
        /// <devdoc>
        ///    <para>
        ///       Implements StartPrint by delegating to the underlying controller.
        ///    </para>
        /// </devdoc>
        public override void OnStartPrint(PrintDocument document, PrintEventArgs e) {
            base.OnStartPrint(document, e);

            this.document = document;
            pageNumber = 1;

            if (SystemInformation.UserInteractive) {
                backgroundThread = new BackgroundThread(this); // starts running & shows dialog automatically
            }

            // OnStartPrint does the security check... lots of 
            // extra setup to make sure that we tear down
            // correctly...
            //
            try {
                underlyingController.OnStartPrint(document, e);
            }
            catch {
                if (backgroundThread != null) {
                    backgroundThread.Stop();
                }
                throw;
            }
            finally {
                if (backgroundThread != null && backgroundThread.canceled) {
                    e.Cancel = true;
                }
            }
        }
示例#28
0
        /// <summary>
        private void Detail_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            var employeeNumber = GetCurrentColumnValue <string>("reference");

            EmployeePayrollDataSet.SalaryDetailsDataTable tbl = new EmployeePayrollDataSet.SalaryDetailsDataTable();

            var benifits = employeePayrollDataSet1.SalaryDetails
                           .Where(u => u.reference == employeeNumber && u.edType == 1).Select(x => x).ToList();

            benifits.ForEach(r => tbl.ImportRow(r));

            xrSubBenifits.ReportSource = new EmployeePaySlipSub(tbl);
            xrSubBenifits.ReportSource.RightToLeftLayout = this.RightToLeftLayout;
            xrSubBenifits.ReportSource.RightToLeft       = this.RightToLeft;

            EmployeePayrollDataSet.SalaryDetailsDataTable tbl2 = new EmployeePayrollDataSet.SalaryDetailsDataTable();

            var deductions = employeePayrollDataSet1.SalaryDetails
                             .Where(u => u.reference == employeeNumber && u.edType == 2).Select(x => x).ToList();

            deductions.ForEach(r => tbl2.ImportRow(r));

            xrSubDeductions.ReportSource = new EmployeePaySlipSub(tbl2);
            xrSubDeductions.ReportSource.RightToLeftLayout = this.RightToLeftLayout;
            xrSubDeductions.ReportSource.RightToLeft       = this.RightToLeft;
        }
示例#29
0
		/// <summary>
		/// Raises the System.Drawing.Printing.PrintDocument.BeginPrint event. It is called
		/// after the System.Drawing.Printing.PrintDocument.Print method is called and before
		/// the first page of the document prints.
		/// </summary>
		/// <param name="e">A System.Drawing.Printing.PrintEventArgs that contains the event data.</param>
		protected override void OnBeginPrint(PrintEventArgs e)
		{
			base.OnBeginPrint(e);

			//Calculate range of pages for print
			switch (PrinterSettings.PrintRange)
			{
				case PrintRange.Selection:
				case PrintRange.CurrentPage: //Curent page
					PrinterSettings.FromPage = _pdfDoc.Pages.CurrentIndex + 1;
					PrinterSettings.ToPage = _pdfDoc.Pages.CurrentIndex + 1;
					break;
				case PrintRange.SomePages: //The range specified by the user
					break;
				default: //All pages
					PrinterSettings.FromPage = PrinterSettings.MinimumPage;
					PrinterSettings.ToPage = PrinterSettings.MaximumPage;
					break;
			}

			_docForPrint = InitDocument();
			if (_docForPrint == IntPtr.Zero)
			{
				e.Cancel = true;
				return;
			}
			_pageForPrint = _useDP ? 0 : PrinterSettings.FromPage - 1;
		}
示例#30
0
        protected override void OnBeginPrint(PrintEventArgs e) {
            base.OnBeginPrint(e);

            m_iTextLength = m_oScintillaControl.TextLength;
            m_iLastPrintPosition = 0;
            m_iCurrentPrintPage = 1;
        }
示例#31
0
        public static void BeginPrint(DataGridView dgView, System.Drawing.Printing.PrintEventArgs e)
        {
            try
            {
                _strFormat               = new StringFormat();
                _strFormat.Alignment     = StringAlignment.Near;
                _strFormat.LineAlignment = StringAlignment.Center;
                _strFormat.Trimming      = StringTrimming.EllipsisCharacter;

                _arrColumnLefts.Clear();
                _arrColumnWidths.Clear();
                _iCellHeight = 0;
                _iRow        = 0;
                _bFirstPage  = true;
                _bNewPage    = true;

                // Calculating Total Widths
                _iTotalWidth = 0;
                foreach (DataGridViewColumn dgvGridCol in dgView.Columns)
                {
                    _iTotalWidth += dgvGridCol.Width;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#32
0
 private void printDocument_EndPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     if (e.PrintAction != PrintAction.PrintToPreview)
     {
         MessageBox.Show(_Resources.PrintFinished);
     }
 }
        private static void PrintDocument_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            try
            {
                strFormat               = new StringFormat();
                strFormat.Alignment     = StringAlignment.Center;
                strFormat.LineAlignment = StringAlignment.Center;
                strFormat.Trimming      = StringTrimming.EllipsisCharacter;
                _printDocument          = new PrintDocument();

                arrColumnLefts.Clear();
                arrColumnWidths.Clear();
                iHeaderHeight = 0;
                iCellHeight   = 0;
                iRow          = 0;
                _pageCount    = 0;
                bFirstPage    = true;
                bNewPage      = true;

                // Calculating Total Widths
                iTotalWidth = 0;
                foreach (DataGridViewColumn dgvGridCol in gw.Columns)
                {
                    if (!dgvGridCol.Visible)
                    {
                        continue;
                    }
                    iTotalWidth += dgvGridCol.Width;
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }
 public override void OnEndPrint(PrintDocument document, PrintEventArgs e)
 {
     this.CheckSecurity(document);
     System.Drawing.IntSecurity.UnmanagedCode.Assert();
     try
     {
         if (this.dc != null)
         {
             try
             {
                 int num = e.Cancel ? SafeNativeMethods.AbortDoc(new HandleRef(this.dc, this.dc.Hdc)) : SafeNativeMethods.EndDoc(new HandleRef(this.dc, this.dc.Hdc));
                 if (num <= 0)
                 {
                     throw new Win32Exception();
                 }
             }
             finally
             {
                 this.dc.Dispose();
                 this.dc = null;
             }
         }
     }
     finally
     {
         CodeAccessPermission.RevertAssert();
     }
     base.OnEndPrint(document, e);
 }
 protected virtual void OnEndPrint(PrintEventArgs e)
 {
     if (this.endPrintHandler != null)
     {
         this.endPrintHandler(this, e);
     }
 }
 protected virtual void OnBeginPrint(PrintEventArgs e)
 {
     if (this.beginPrintHandler != null)
     {
         this.beginPrintHandler(this, e);
     }
 }
示例#37
0
        /// <summary>
        /// 印刷初期化
        /// </summary>
        /// <param name="e">発生したイベント</param>
        protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
        {
            if (TimeTable == null)
            {
                return;
            }
            CachedStart = Start;
            CachedEnd   = End;
            // タイムテーブルによる設定
            header.TimeTable = TimeTable;
            header.Document  = this;
            footer.TimeTable = TimeTable;
            footer.Document  = this;
            index            = 0;
            // メンバーの一覧設定
            members.Clear();
            int z = TimeTable.Members.Size(true);

            for (int i = 0; i < z; i++)
            {
                CMember member = TimeTable.Members[i, true];
                if (member.IsAvailable(Start) || member.IsAvailable(End))
                {
                    members.Add(member);
                }
            }
            // ページの作成
            TimeSpan ONEDAY = new TimeSpan(1, 0, 0, 0);

            pages.Clear();
            bool       cont1 = true;
            DateTime   k     = Start;
            CPageIndex page  = null;

            while (cont1)
            {
                int  j     = 0;
                bool cont2 = true;
                while (cont2)
                {
                    page                  = new CPageIndex();
                    page.Document         = this;
                    page.Start            = k;
                    page.MemberStartIndex = j;
                    page.CalcPage();
                    pages.Add(page);
                    j = page.MemberEndIndex + 1;
                    if (j >= members.Count)
                    {
                        cont2 = false;
                    }
                }
                k = page.End.AddDays(1);
                if (k >= End)
                {
                    cont1 = false;
                }
            }
        }
示例#38
0
        private static void PrintDoc_BeginPrint(object sender,
                                                System.Drawing.Printing.PrintEventArgs e)
        {
            try
            {
                // Formatting the Content of Text Cell to print
                HdrFormat               = new StringFormat();
                HdrFormat.Alignment     = StringAlignment.Center;
                HdrFormat.LineAlignment = StringAlignment.Center;
                HdrFormat.FormatFlags   = StringFormatFlags.NoWrap;
                HdrFormat.Trimming      = StringTrimming.EllipsisCharacter;

                // Formatting the Content of Text Cell to print
                StrFormat               = new StringFormat();
                StrFormat.Alignment     = StringAlignment.Near;
                StrFormat.LineAlignment = StringAlignment.Center;
                StrFormat.FormatFlags   = StringFormatFlags.NoWrap;
                StrFormat.Trimming      = StringTrimming.EllipsisCharacter;

                // Formatting the Content of Combo Cells to print
                StrFormatComboBox = new StringFormat();
                StrFormatComboBox.LineAlignment = StringAlignment.Center;
                StrFormatComboBox.FormatFlags   = StringFormatFlags.NoWrap;
                StrFormatComboBox.Trimming      = StringTrimming.EllipsisCharacter;

                ColumnLefts.Clear();
                ColumnWidths.Clear();
                ColumnTypes.Clear();
                CellHeight  = 0;
                RowsPerPage = 0;

                // For various column types
                CellButton   = new Button();
                CellCheckBox = new CheckBox();
                CellComboBox = new ComboBox();

                // Calculating Total Widths
                TotalWidth = 0;
                foreach (DataGridViewColumn GridCol in dgv.Columns)
                {
                    if (!GridCol.Visible)
                    {
                        continue;
                    }
                    if (!PrintDGV.SelectedColumns.Contains(GridCol.HeaderText))
                    {
                        continue;
                    }
                    TotalWidth += GridCol.Width;
                }
                PageNo  = 1;
                NewPage = true;
                RowPos  = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 internal void Print(PrintDocument document)
 {
     PrintAction printToPreview;
     IntSecurity.SafePrinting.Demand();
     if (this.IsPreview)
     {
         printToPreview = PrintAction.PrintToPreview;
     }
     else
     {
         printToPreview = document.PrinterSettings.PrintToFile ? PrintAction.PrintToFile : PrintAction.PrintToPrinter;
     }
     PrintEventArgs e = new PrintEventArgs(printToPreview);
     document._OnBeginPrint(e);
     if (e.Cancel)
     {
         document._OnEndPrint(e);
     }
     else
     {
         this.OnStartPrint(document, e);
         if (e.Cancel)
         {
             document._OnEndPrint(e);
             this.OnEndPrint(document, e);
         }
         else
         {
             bool flag = true;
             try
             {
                 flag = this.PrintLoop(document);
             }
             finally
             {
                 try
                 {
                     try
                     {
                         document._OnEndPrint(e);
                         e.Cancel = flag | e.Cancel;
                     }
                     finally
                     {
                         this.OnEndPrint(document, e);
                     }
                 }
                 finally
                 {
                     if (!IntSecurity.HasPermission(IntSecurity.AllPrinting))
                     {
                         IntSecurity.AllPrinting.Assert();
                         document.PrinterSettings.PrintDialogDisplayed = false;
                     }
                 }
             }
         }
     }
 }
 public virtual void OnEndPrint(PrintDocument document, PrintEventArgs e)
 {
     IntSecurity.UnmanagedCode.Assert();
     if (this.modeHandle != null)
     {
         this.modeHandle.Close();
     }
 }
示例#41
0
 private void m_printDoc_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     m_objReportPrint.m_mthInitPrintTool(m_printDoc);
     if (m_objPrint != null && m_objPrint.dictReportPrint != null && m_objPrint.dictReportPrint.Count > 0)
     {
         m_objReportPrint.m_mthBeginPrint(this.m_objPrint);
     }
 }
示例#42
0
 private void m_printDoc_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     if (m_objPrintTool != null)
     {
         this.m_objPrintTool.m_mthInitPrintTool(this.m_printDoc);
         this.m_objPrintTool.m_mthBeginPrint(this.m_ObjPrintInfo);
     }
 }
		//Override OnBeginPrint to set up the font we are going to use
		protected override void OnBeginPrint(PrintEventArgs ev) 
		{
			base.OnBeginPrint(ev) ;
			printHeaderFont = new Font("Arial", 14,System.Drawing.FontStyle.Bold);

			printCompetitorFont = new Font("Arial", 10, System.Drawing.FontStyle.Regular);
			printAllbergFont = new Font("Arial", 8, System.Drawing.FontStyle.Regular);
		}
示例#44
0
        protected override void OnBeginPrint(PrintEventArgs e)
        {
            base.OnBeginPrint(e);

            _iPosition = 0;
            _iPrintEnd = sci.GetTextLength();
            _iCurrentPage = 1;
        }
示例#45
0
 private void m_PrintDocument_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     if (this.PrintBefore != null)
     {
         this.PrintBefore(this, new PrintEventArgs(this.m_PrintDocument));
     }
     this.m_PageIndex = 1;
 }
 void pd_EndPrint(object sender, PrintEventArgs e)
 {
     //Cleanup: may get called multiple times
     foreach (var s in _PrintingStreams) s.Dispose();
     _PrintingStreams.Clear();
     //And reset for next time
     _PrintingIndex = 0;
 }
示例#47
0
        protected override void OnBeginPrint(PrintEventArgs e)
        {
            base.OnBeginPrint(e);

            DefaultPageSettings.Landscape = true;
            itemIterator = items.GetEnumerator();
            hasMoreItemsToPrint = itemIterator.MoveNext();
        }
示例#48
0
文件: Print.cs 项目: Hli4S/TestMeApp
 private static void beginPrint(object sender, PrintEventArgs e)
 {
     iq = 0;
     ia = 0;
     flagBreak = false;
     typedQ = false;
     noPage = 1;
 }
		protected override void OnBeginPrint(PrintEventArgs ev)
		{
			base.OnBeginPrint(ev);
			if (this.fntPrintFont == null)
			{
				this.fntPrintFont = new System.Drawing.Font("Times New Roman", 12f);
			}
		}
 public override void OnStartPrint(PrintDocument prndoc,
                                     PrintEventArgs pea)
 {
     strSaveText = statpanel.Text;
     statpanel.Text = "Starting printing";
     iPageNumber = 1;
     base.OnStartPrint(prndoc, pea);
 }
示例#51
0
        /// <summary>
        ///     Method called after the Print method is called and before the first page of the document prints
        /// </summary>
        /// <param name="e">A PrintPageEventArgs that contains the event data</param>
        protected override void OnBeginPrint(PrintEventArgs e)
        {
            base.OnBeginPrint(e);

            this._iPosition = 0;
            this._iPrintEnd = this._oScintillaControl.TextLength;
            this._iCurrentPage = 1;
        }
示例#52
0
 private void printDocument1_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     printPreviewDialog1.PrintPreviewControl.Zoom = 1.2;
     printPreviewDialog1.WindowState = FormWindowState.Maximized;
     //printDocument1.DefaultPageSettings.PaperSize =
     //    new PaperSize("16K", 737, 1020);
     printDocument1.DefaultPageSettings.PaperSize =
         new PaperSize("A4", 820, 1160);
 }
示例#53
0
        protected override void OnBeginPrint(System.Drawing.Printing.PrintEventArgs e)
        {
            if (_imagesSource == null && QueryImage == null)
            {
                e.Cancel = true;
            }

            base.OnBeginPrint(e);
        }
示例#54
0
文件: Printing.cs 项目: mnisl/OD
 public override void OnStartPrint(PrintDocument document, PrintEventArgs e)
 {
     _isPrintToFile = document.PrinterSettings.PrintToFile;
     document.PrinterSettings.PrintToFile = true;
     document.PrinterSettings.PrintFileName = FileName;
     if(SetReadOnly)
         document.Disposed += document_Disposed;
     base.OnStartPrint(document, e);
 }
		public override void OnEndPrint(PrintDocument document, PrintEventArgs e)
		{
			System.Diagnostics.Trace.WriteLine("ExtPrintcontroller OnEndprint");
			PreviewPrintController c = this.controller as PreviewPrintController;
			if (c != null) {
				PreviewPageInfo[] ppia = c.GetPreviewPageInfo();
			}
			this.controller.OnEndPrint(document,e);
		}
示例#56
0
 private void printDocument_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     preview     = (e.PrintAction == PrintAction.PrintToPreview);
     printerFont = new Font("Times New Roman", 12);
     foreach (Text text in document.TextBindingList)
     {
         stringToPrint += text.ToString();
     }
 }
示例#57
0
        protected override void OnBeginPrint(PrintEventArgs e)
        {
            base.OnBeginPrint(e);

            if (_font == null)
            {
                _font = new Font("Times New Roman", 10);
            }
        }
示例#58
0
        protected override void OnBeginPrint(PrintEventArgs e)
        {
            base.OnBeginPrint(e);
            // 9x13cm v palcoch = 3.54x5.12
            //DefaultPageSettings.PaperSize = new PaperSize("psize", 354, 512);

            // 9.6x13.6cm v palcoch = 3.78x5.35
            DefaultPageSettings.PaperSize = new PaperSize("psize", 345, 495);
        }
示例#59
0
 private void printDocument1_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     pageCount           = 0;
     maxCountPerPage     = listCount * rowCount; //每页最大单子数
     DestinationTBString = DestinationTB.Text;   //到站
     nameTBString        = nameTB.Text;          //收货人
     countNumTBString    = countNumTB.Text;      //件数
     numberTBString      = numberTB.Text;        //货号
 }
示例#60
0
        private void xrRichText1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            //if (!string.IsNullOrEmpty((sender as XRRichText).Text))
            //{

            //    (sender as XRRichText).Text = Convert.ToDouble((sender as XRRichText).Text).ToString("N2");


            //}
        }