当前位置: 首页>>代码示例>>C#>>正文


C# Printing.PrintDocument类代码示例

本文整理汇总了C#中System.Drawing.Printing.PrintDocument的典型用法代码示例。如果您正苦于以下问题:C# System.Drawing.Printing.PrintDocument类的具体用法?C# System.Drawing.Printing.PrintDocument怎么用?C# System.Drawing.Printing.PrintDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


System.Drawing.Printing.PrintDocument类属于命名空间,在下文中一共展示了System.Drawing.Printing.PrintDocument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnPrint_Click

        private void btnPrint_Click(object sender, EventArgs e)
        {
            gcOptions.Visible = false;

            using (System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument())
            {
                printDocument.PrintPage += printDocument_PrintPage;
                printDocument.DefaultPageSettings.Landscape = true;
                printDocument.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("FalseX", 500, 1000);
                //Resize
                Size = new Size(974, 507);
                CaptureScreen();
                try
                {
                    //printDocument.Print();
                    PrintPreviewDialog PPdlg = new PrintPreviewDialog() { Document = printDocument };
                    PPdlg.Show();
                }
                catch (Exception ex)
                {
                    Program.ShowMsg(ex.Message, true, this);
                    Program.Logger.LogThis(null, Text, FXFW.Logger.OpType.fail, ex, null, this);
                }
            }
            Size = new Size(974, 589);
            gcOptions.Visible = true;
        }
开发者ID:EgyFalseX-EESoft-WinForm,项目名称:School,代码行数:27,代码来源:QryWeekTeacherTableFrm.cs

示例2: frmSplash_Load

        private void frmSplash_Load(object sender, EventArgs e)
        {
            this.pnlSplashScreen.Left = (this.Width - this.pnlSplashScreen.Width) / 2 ;
            this.pnlSplashScreen.Top = (this.Height - this.pnlSplashScreen.Height) / 2 ;
            timer1.Enabled = true;
            string printerName = "Posiflex PP6900 Partial Cut v3.01"; // Your Printer Name
            System.Drawing.Printing.PrintDocument doctoprint = new System.Drawing.Printing.PrintDocument();
            doctoprint.PrinterSettings.PrinterName = printerName;
            //int rawKind = 0;
            //for (int i = 0; i <= doctoprint.PrinterSettings.PaperSizes.Count - 1; i++)
            //{
            //    if (doctoprint.PrinterSettings.PaperSizes[i].PaperName == "3.14 x 6 in") // "LXP : Your Page Size"
            //    {
            //        rawKind = Convert.ToInt32(doctoprint.PrinterSettings.PaperSizes[i].GetType().GetField
            //         ("kind",
            //        System.Reflection.BindingFlags.Instance |
            //        System.Reflection.BindingFlags.NonPublic).GetValue(doctoprint.PrinterSettings.PaperSizes[i]));
            //        break;
            //    }
            //}

            //rpt_test rpt = new rpt_test();
            //rpt.SetParameterValue("p_invoiceid", 1);
            //rpt.SetParameterValue("p_received", 100.0);
            //rpt.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)rawKind;
            //rpt.PrintOptions.PaperSize = "3.14 x 6 in";
            //rpt.PrintOptions.ApplyPageMargins(new CrystalDecisions.Shared.PageMargins(0, 0, 0, 0));
            //rpt.PrintToPrinter(1, false, 0, 0);
            //rpt.Refresh();
        }
开发者ID:KH4IT,项目名称:MakeOver-Paris,代码行数:30,代码来源:FrmSplash.cs

示例3: btnin_Click

 private void btnin_Click(object sender, EventArgs e)
 {
     if(issave == false)
     {
         if(MessageBox.Show("Bạn phải lưu trước khi in, lưu ngay?", "Thông báo", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             btnluu.PerformClick();
             System.Drawing.Printing.PrintDocument myPrintDocument1 = new System.Drawing.Printing.PrintDocument();
             PrintDialog myPrinDialog1 = new PrintDialog();
             myPrintDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(myPrintDocument2_PrintPage);
             myPrinDialog1.Document = myPrintDocument1;
             if (myPrinDialog1.ShowDialog() == DialogResult.OK)
             {
                 myPrintDocument1.Print();
                 MessageBox.Show("In phiếu đặt chỗ thành công!", "Thông báo");
             }
         }
         else
         {
             System.Drawing.Printing.PrintDocument myPrintDocument1 = new System.Drawing.Printing.PrintDocument();
             PrintDialog myPrinDialog1 = new PrintDialog();
             myPrintDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(myPrintDocument2_PrintPage);
             myPrinDialog1.Document = myPrintDocument1;
             if (myPrinDialog1.ShowDialog() == DialogResult.OK)
             {
                 myPrintDocument1.Print();
                 MessageBox.Show("In phiếu đặt chỗ thành công!", "Thông báo");
             }
         }
     }
 }
开发者ID:trantuuit,项目名称:QLBanVeChuyenBay,代码行数:31,代码来源:LapPhieuDatCho.cs

示例4: IHCMolecularRequisition

 public IHCMolecularRequisition(int clientId)
 {
     this.m_PrintDocument = new System.Drawing.Printing.PrintDocument();
     this.m_ClientId = clientId;
     this.m_ClientPhysicianView = YellowstonePathology.Business.Gateway.PhysicianClientGateway.GetClientPhysicianViewByClientIdV2(this.m_ClientId);
     this.m_Barcode = new YellowstonePathology.Business.BarcodeScanning.BarcodeVersion1(YellowstonePathology.Business.BarcodeScanning.BarcodePrefixEnum.CLNT, this.m_ClientId.ToString());
 }
开发者ID:WilliamCopland,项目名称:YPILIS,代码行数:7,代码来源:IHCMolecularRequisition.cs

示例5: Print

 public void Print()
 {
     this.m_PrintDocument = new System.Drawing.Printing.PrintDocument();
     this.m_PrintDocument.PrinterSettings = new System.Drawing.Printing.PrinterSettings();
     this.m_PrintDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(PrintDocument_PrintPage);
     this.m_PrintDocument.Print();
 }
开发者ID:WilliamCopland,项目名称:YPILIS,代码行数:7,代码来源:PantherAliquotReport.cs

示例6: Print

 public virtual void Print()
 {
     System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument();
     printDocument.PrinterSettings.PrinterName = this.m_PrintQueue.FullName;
     printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(PrintDocument_PrintPage);
     printDocument.Print();
 }
开发者ID:WilliamCopland,项目名称:YPILIS,代码行数:7,代码来源:LabelPrinter.cs

示例7: TmrPrint_Tick

        private void TmrPrint_Tick(object sender, EventArgs e)
        {
            pnlPrint.Visible = false;
            TmrPrint.Enabled = false;

            using (System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument())
            {
                printDocument.PrintPage += printDocument_PrintPage;
                CaptureScreen();
                try
                { 
                    
                    PrintDialog dlg = new PrintDialog();
                    dlg.Document = printDocument;
                    dlg.PrinterSettings.Copies = 3;
                    if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        printDocument.PrinterSettings = dlg.PrinterSettings;
                        printDocument.Print();
                    }
                    else
                    {
                        pnlPrint.Visible = true;
                        return;
                    }
                }
                catch (Exception ex)
                { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,MessageBoxIcon.Error); }
            }
            Close();
            pnlPrint.Visible = true;
            
        }
开发者ID:EgyFalseX,项目名称:Winform,代码行数:33,代码来源:BillResitFrm.cs

示例8: button10_Click

 private void button10_Click(object sender, EventArgs e)
 {
     doc2 = new System.Drawing.Printing.PrintDocument();
     icodigo = 0;
     jcodigo = 0;
     label9.Text = "0";
 }
开发者ID:JoseRochaVidrio,项目名称:SistemaCaritas,代码行数:7,代码来源:Almacen.cs

示例9: btnPrint_Click

        private void btnPrint_Click(object sender, EventArgs e)
        {
            if(_options == null || _options.ReportText == null)
            {
                //no report
                return;
            }

            using (PrintDialog dialog = new PrintDialog())
            {
                using (System.Drawing.Printing.PrintDocument doc = new System.Drawing.Printing.PrintDocument())
                {
                    dialog.AllowSomePages = true;
                    dialog.ShowHelp = true;
                    dialog.Document = doc;

                    doc.PrintPage += doc_PrintPage;

                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        MemoryStream stream = new MemoryStream();
                        StreamWriter writer = new StreamWriter(stream);
                        writer.Write(_options.ReportText.ToString());

                        /*
                        foreach (string line in _options.ReportText.ToString().
                            Split( new string[] {Environment.NewLine},
                                StringSplitOptions.None))
                        {
                            if (line.Length <= 40)
                                writer.WriteLine(line);
                            else
                            {
                                int remaining = line.Length;
                                for (int start = 0; start < line.Length; start += 40)
                                {
                                    if (remaining > 40)
                                        writer.WriteLine(line.Substring(start, 40));
                                    else
                                        writer.WriteLine(line.Substring(start, remaining));

                                    remaining -= 40;
                                }
                            }
                        }
                        */

                        writer.Flush();
                        stream.Position = 0;

                        streamToPrint = new StreamReader(stream);

                        doc.Print();
                    }

                    doc.PrintPage -= doc_PrintPage;
                }
            }
        }
开发者ID:FMSC-Measurements,项目名称:TwoTrailsV2,代码行数:59,代码来源:HowAmIDoingForm.cs

示例10: PrintReceipt

        public PrintReceipt(string aLogoFilename)
        {
            printDocument = new System.Drawing.Printing.PrintDocument();
            printDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(printDocument_PrintPage);
            printDocument.BeginPrint +=new System.Drawing.Printing.PrintEventHandler(printDocument_BeginPrint);

            logoFilename = aLogoFilename;
        }
开发者ID:andersruberg,项目名称:RehabLight,代码行数:8,代码来源:PrintReceipt.cs

示例11: HistologySlideLabelDocument

 public HistologySlideLabelDocument(YellowstonePathology.Business.BarcodeScanning.HistologySlide histologySlide, int labelCount)
 {
     this.m_PrintDocument = new System.Drawing.Printing.PrintDocument();
     this.m_HistologySlideQueue = new Queue<Business.BarcodeScanning.HistologySlide>();
     for (int i = 0; i < labelCount; i++)
     {
         this.m_HistologySlideQueue.Enqueue(histologySlide);
     }
 }
开发者ID:WilliamCopland,项目名称:YPILIS,代码行数:9,代码来源:HistologySlideLabelDocument.cs

示例12: PrintingService

		public PrintingService()
		{
			// we initialize the printer variables
			_printDocument = new System.Drawing.Printing.PrintDocument();
			// we set the print document default orientation to landscape
			_printDocument.DefaultPageSettings.Landscape = true;
			_printerSettings = new System.Drawing.Printing.PrinterSettings();
			UpdateBoundsAndMargins();
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:9,代码来源:PrintingService.cs

示例13: Print

 public void Print()
 {
     this.m_PrintDocument = new System.Drawing.Printing.PrintDocument();
     System.Printing.PrintServer printServer = new System.Printing.LocalPrintServer();
     System.Printing.PrintQueue printQueue = printServer.GetPrintQueue(YellowstonePathology.Business.User.UserPreferenceInstance.Instance.UserPreference.HistologySlideLabelPrinter);
     this.m_PrintDocument.PrinterSettings.PrinterName = printQueue.FullName;
     this.m_PrintDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(PrintDocument_PrintPage);
     this.m_PrintDocument.Print();
 }
开发者ID:WilliamCopland,项目名称:YPILIS,代码行数:9,代码来源:SlideLabelPrinter.cs

示例14: TextDocumentPrinter

        //-----------------------------------------------------------------------------------
        #endregion
        //-----------------------------------------------------------------------------------
        #region Constructors
        //-----------------------------------------------------------------------------------
        /// <summary>
        /// Конструктор
        /// </summary>
        public TextDocumentPrinter()
        {
            _PrintDocument = new System.Drawing.Printing.PrintDocument();
            _PrintDocument.PrintPage += 
                new System.Drawing.Printing.PrintPageEventHandler(_PrintDocument_PrintPage);

            // Шрифт по умолчанию
            _PrintFont = new System.Drawing.Font("Courier New", 10);
        }
开发者ID:serialbus,项目名称:NGK,代码行数:17,代码来源:TextDocumentPrinter.cs

示例15: btnin_Click

        private void btnin_Click(object sender, EventArgs e)
        {
            System.Drawing.Printing.PrintDocument myPrintDocument1 = new System.Drawing.Printing.PrintDocument();
            PrintDialog myPrinDialog1 = new PrintDialog();
            myPrintDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(myPrintDocument2_PrintPage);
            myPrinDialog1.Document = myPrintDocument1;

            if (myPrinDialog1.ShowDialog() == DialogResult.OK)
            {
                myPrintDocument1.Print();
                MessageBox.Show("In báo cáo thành công!", "Thông báo");
            }
        }
开发者ID:trantuuit,项目名称:QLBanVeChuyenBay,代码行数:13,代码来源:BaoCaoDoanhThuNam.cs


注:本文中的System.Drawing.Printing.PrintDocument类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。