• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Printing.PrintDocument类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: cmdPrintToPrinter_Click

 private void cmdPrintToPrinter_Click(object sender, EventArgs e)
 {
     System.Drawing.Printing.PrintDocument printdoc = new System.Drawing.Printing.PrintDocument();
     printdoc.PrintPage += (e2, s2) =>
     {
         var g = s2.Graphics;
         var canvasInit = new PixelFarm.Drawing.CanvasInitParameters();
         canvasInit.externalCanvas = g;
         var canvas = LayoutFarm.UI.GdiPlus.MyWinGdiPortal.P.CreateCanvas(0, 0, 800, 600, canvasInit);
         vwport.PrintMe((PixelFarm.Drawing.WinGdi.MyGdiPlusCanvas)canvas);
     };
     printdoc.Print();
 }
开发者ID:prepare,项目名称:HTML-Renderer,代码行数:13,代码来源:FormPrint.cs


示例17: TmrPrint_Tick

 private void TmrPrint_Tick(object sender, EventArgs e)
 {
     TmrPrint.Enabled = false;
     using (System.Drawing.Printing.PrintDocument printDocument = new System.Drawing.Printing.PrintDocument())
     {
         printDocument.PrintPage += printDocument_PrintPage;
         CaptureScreen();
         try
         { printDocument.Print(); }
         catch (Exception ex)
         { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,MessageBoxIcon.Error); }
     }
     Close();
 }
开发者ID:EgyFalseX-EESoft-WinForm,项目名称:StoreAccount,代码行数:14,代码来源:BillResitFrm.cs


示例18: buttonImprimir_Click

        private void buttonImprimir_Click(object sender, EventArgs e)
        {
            //using (var printDocument = new System.Drawing.Printing.PrintDocument())
            //{
            //    printDocument.PrintPage += printDocument_PrintPage;
            //    printDocument.PrinterSettings.PrinterName = comboBoxImpressoras.SelectedItem.ToString();
            //    printDocument.Print();
            //}

            using (var printDocument = new System.Drawing.Printing.PrintDocument())
            {
                printDocument.PrintPage += printDocument_PrintPage;
                printDocument.PrinterSettings.PrinterName = comboBoxImpressoras.SelectedItem.ToString();
                _texto = textBoxImpressao.Text;
                printDocument.Print();
            }
        }
开发者ID:Alexssandrolima,项目名称:estudos,代码行数:17,代码来源:FormImpressao.cs


示例19: btnPrint_Click

        private void btnPrint_Click(object sender, EventArgs e)
        {
            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;
                }
                
            }

            if (txtRecieve.Text != "")
            {
                //MakeOver_Paris.rpt_saleinvoice rpt = new rpt_saleinvoice();
                MakeOver_Paris.rpt_test rpt = new rpt_test();
                rpt.Refresh();
                rpt.SetParameterValue("p_invoiceid", invoiceid);
                rpt.SetParameterValue("p_received", decimal.Parse(txtRecieve.Text));
                try
                {
                    rpt.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA5;
                    rpt.PrintToPrinter(1, false, 0, 0);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
                DTO.Transaction transaction = new DTO.Transaction();
                transaction.Incomeamount = decimal.Parse(txtTotal.Text);
                transaction.Createdby = UserSession.Session.Staff;
                transaction.Remark = "InvoiceID: " + invoiceid;
                new DAO.TransactionDAO().AddTransaction(transaction);
                this.Dispose();
            }
        }
开发者ID:KH4IT,项目名称:MakeOver-Paris,代码行数:45,代码来源:FrmPay.cs


示例20: ReportDialog

        /// <summary>
        /// Constructor for the Printout dialog
        /// </summary>
        /// <param name="frm"></param>
        public ReportDialog(Epi.Windows.Analysis.Forms.AnalysisMainForm frm)
            : base(frm)
        {
            InitializeComponent();
            Construct();
            radioButtonDisplay.Checked = true;
            textBoxFileSavePath.Text = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "Reports");

            foreach (String printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
            {
                comboBoxSelectPrinter.Items.Add(printer.ToString());
            }

            System.Drawing.Printing.PrintDocument prtdoc = new System.Drawing.Printing.PrintDocument();
            string defaultPrinter = prtdoc.PrinterSettings.PrinterName;
            comboBoxSelectPrinter.Text = defaultPrinter;
            GenerateCommand();
        }
开发者ID:NALSS,项目名称:epiinfo-82474,代码行数:22,代码来源:ReportDialog.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Drawing.Rectangle类代码示例发布时间:2022-05-24
下一篇:
C# Drawing.PointF类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap