添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

示例1: PrintClass

 /// <summary>
 /// 打印信息的初始化
 /// </summary>
 /// <param datagrid="DataGridView">打印数据</param>
 /// <param PageS="int">纸张大小</param>
 /// <param lendscape="bool">是否横向打印</param>
 public PrintClass(DataGridView datagrid, int PageS, bool lendscape)
     this.datagrid = datagrid;//获取打印数据
     this.PageSheet = PageS;//纸张大小
     printdocument = new PrintDocument();//实例化PrintDocument类
     pagesetupdialog = new PageSetupDialog();//实例化PageSetupDialog类
     pagesetupdialog.Document = printdocument;//获取当前页的设置
     printpreviewdialog = new PrintPreviewDialog();//实例化PrintPreviewDialog类
     printpreviewdialog.Document = printdocument;//获取预览文档的信息
     printpreviewdialog.FormBorderStyle = FormBorderStyle.Fixed3D;//设置窗体的边框样式
     //横向打印的设置
     if (PageSheet >= 0)
         if (lendscape == true)
             printdocument.DefaultPageSettings.Landscape = lendscape;//横向打印
             printdocument.DefaultPageSettings.Landscape = lendscape;//纵向打印
     pagesetupdialog.Document = printdocument;
     printdocument.PrintPage += new PrintPageEventHandler(this.printdocument_printpage);//事件的重载
 }
开发者ID:mahuidong, 项目名称:c-1200-II, 代码行数:31, 代码来源: PrintClass.cs

 private void bPay_Click(object sender, EventArgs e)
     DB.Instance.Insert("order", new Parameter("customer_id", cid), new Parameter("dt", DateTime.Now), new Parameter("status", OrderStatus.New));
     uint oid = 0;
     using (MySqlDataReader reader = DB.Instance.SelectReader("select max(id) from order"))
         if(reader != null && reader.Read()){
             oid = reader.GetUInt32(0);
     foreach (var item in Role.Instance.ShopCart)
         DB.Instance.Insert("order_inventory", new Parameter("order_id", oid), new Parameter("inventory_id", item.ID), new Parameter("amount", item.Qty));
     var dr = MessageBox.Show("Order Placed. Would you like to pay now?", "Payment", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
     if (dr == DialogResult.Yes)
         new Payment().ShowDialog();
     else if(dr == DialogResult.No)
         var ppd = new PrintPreviewDialog();
         PrintDocument pd = new PrintDocument();
         ppd.Document = pd;
         pd.PrintPage += Pd_PrintPage;
         ppd.ShowDialog();
 }
开发者ID:redlive, 项目名称:csis3275, 代码行数:28, 代码来源: Checkout.cs

示例3: PrintOrder

 public static void PrintOrder()
     var doc = new PrintDocument();
     doc.PrinterSettings.PrinterName = System.Configuration.ConfigurationManager.AppSettings["PrinterName"];
     doc.PrintPage += new PrintPageEventHandler(PrintPage);
     doc.Print();
 }
开发者ID:argetima, 项目名称:Golex, 代码行数:7, 代码来源: Extensions.cs

this.OriginController.OnEndPage(document, e); }
开发者ID:renyh1013, 项目名称:dp2, 代码行数:7, 代码来源: NewPrintController.cs

示例5: PrintClicked

        private void PrintClicked(object sender, System.EventArgs e)
            if (Viewer == null)
                return;
            PrintDocument pd = new PrintDocument();
            pd.DocumentName = Viewer.SourceFile.LocalPath;
            pd.PrinterSettings.FromPage = 1;
            pd.PrinterSettings.ToPage = Viewer.PageCount;
            pd.PrinterSettings.MaximumPage = Viewer.PageCount;
            pd.PrinterSettings.MinimumPage = 1;
            pd.DefaultPageSettings.Landscape = Viewer.PageWidth > Viewer.PageHeight ? true : false;
            using (PrintDialog dlg = new PrintDialog())
                dlg.Document = pd;
                dlg.AllowSelection = true;
                dlg.AllowSomePages = true;
                if (dlg.ShowDialog() == DialogResult.OK)
                    Viewer.Print(pd);
        }
开发者ID:myersBR, 项目名称:My-FyiReporting, 代码行数:26, 代码来源: ViewerToolstrip.cs

示例6: Print

        public void Print()
            try {
                _current = 0;
                PrintDocument document = new PrintDocument();
                document.PrinterSettings = _config.PrinterSettings;
                document.PrinterSettings.Collate = true;
                document.PrinterSettings.Copies = (short)_session.NumberOfCopies;
                //document.DefaultPageSettings.Margins = new Margins(100, 100, 100, 100);
                document.DefaultPageSettings.Margins = new Margins(25, 25, 25, 25);
                document.QueryPageSettings += OnQueryPageSettings;
                document.PrintPage += OnPrintPage;
                if (!String.IsNullOrEmpty(_config.PaperSource)) {
                    foreach (PaperSource source in document.PrinterSettings.PaperSources) {
                        if (source.SourceName == _config.PaperSource)
                            document.DefaultPageSettings.PaperSource = source;
                if (_config.PreviewOnly) {
                    if (Application.OpenForms.Count > 0)
                        Application.OpenForms[0].BeginInvoke(new WaitCallback(PreviewProc), document);
                } else {
                    document.Print();
            } catch (Exception ex) {
            #if DEBUG
                Dicom.Debug.Log.Error("DICOM Print Error: " + ex.ToString());
            #else
                Dicom.Debug.Log.Error("DICOM Print Error: " + ex.Message);
            #endif
        }
开发者ID:k11hao, 项目名称:mdcm-printscp, 代码行数:35, 代码来源: NPrintService.cs

示例7: InitializeComponent

 private void InitializeComponent()
     this.printDocument1 = new System.Drawing.Printing.PrintDocument();
     //Main DataSet Initialization
     this.printPreviewDialog1 = new PrintPreviewDialog();
     this.maindataset = new SupremeTransport.maindataset();
     //Table Adapter Initialization
     this.mainbillTableAdapter = new SupremeTransport.maindatasetTableAdapters.mainbillTableAdapter();
     this.billTableAdapter = new SupremeTransport.maindatasetTableAdapters.billTableAdapter();
     // printDocument1
     this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
     // printPreviewDialog1
     this.printPreviewDialog1.AutoScrollMargin = new System.Drawing.Size(0, 0);
     this.printPreviewDialog1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
     this.printPreviewDialog1.ClientSize = new System.Drawing.Size(400, 300);
     this.printPreviewDialog1.Enabled = true;
     this.printPreviewDialog1.Name = "printPreviewDialog1";
     this.printPreviewDialog1.Visible = false;
 }
开发者ID:EdiCarlos, 项目名称:MyPractices, 代码行数:27, 代码来源: PrintingClass.cs

示例8: Execute

        public override void Execute()
            printDocument = new PrintDocument();
              printDocument.OriginAtMargins = true;
              printDocument.BeginPrint += new PrintEventHandler(printDocument_BeginPrint);
              printDocument.PrintPage += new PrintPageEventHandler(printDocument_PrintPage);
              Dictionary<String, Object> paperSettings = Printing.getPaperSettings(grtArguments);
              printDocument.DefaultPageSettings.Landscape = (string)paperSettings["orientation"] == "landscape";
              // Sizes must be given in inch * 100 (sigh).
              int paperWidth = (int)Math.Round((double)paperSettings["width"] / 0.254);
              int paperHeight = (int)Math.Round((double)paperSettings["height"] / 0.254);
              PaperSize paperSize = new PaperSize("Doesn't matter", paperWidth, paperHeight);
              printDocument.DefaultPageSettings.PaperSize = paperSize;
              if ((bool)paperSettings["marginsSet"])
            printDocument.DefaultPageSettings.Margins =
              new Margins((int)paperSettings["marginLeft"], (int)paperSettings["marginRight"],
            (int)paperSettings["marginTop"], (int)paperSettings["marginBottom"]);
              printDialog = new System.Windows.Forms.PrintDialog();
              printDialog.Document = printDocument;
              printDialog.AllowPrintToFile = true;
              pageNumber = 0;
              pageCount = -1;
              if (printDialog.ShowDialog() == DialogResult.OK)
            printDocument.Print();
        }
开发者ID:abibell, 项目名称:mysql-workbench, 代码行数:34, 代码来源: PrintDialog.cs

示例9: OnStartPrint

        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:"
                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);
        }
开发者ID:JianwenSun, 项目名称:cc, 代码行数:32, 代码来源: DefaultPrintController.cs

示例10: Print_button_Click

 /* Events to execute when the "Print" button is clicked */
 private void Print_button_Click(object sender, EventArgs e)
     /* Creates a new instance of printDocument, appends the result from PrintDocumentOnPrintPage and prints the result */
     PrintDocument printDocument = new PrintDocument();
     printDocument.PrintPage += PrintDocumentOnPrintPage;
     printDocument.Print();
 }
开发者ID:Nicolai-, 项目名称:CSharp_Mail_Client_New, 代码行数:8, 代码来源: ShowMail.cs

示例11: axWindowsMediaPlayer1_PlayStateChange

        private void axWindowsMediaPlayer1_PlayStateChange(object sender, _WMPOCXEvents_PlayStateChangeEvent e)
            //QUANDO VIDEO FOR PARADO
            if (  axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsPaused )
                //O VIDEO FOI PARADO, PARA CONTINUAR PRECISA CLICAR EM OK
                if ( MessageBox.Show("Video Parado. Clique aqui para continuar!", "",
                    MessageBoxButtons.OK , MessageBoxIcon.Information) == DialogResult.OK )
                    axWindowsMediaPlayer1.Ctlcontrols.play();
            //QUANDO O VIDEO ACABAR
            if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsMediaEnded)
                //IMPRIME
                PrintDocument document = new PrintDocument();
                document.PrintPage += new PrintPageEventHandler(impressaoConf);
                document.Print();
                this.Hide();
        }
开发者ID:marcommas, 项目名称:videoAlstomCSharp, 代码行数:25, 代码来源: Login.cs

示例12: Imprimir

        public static void Imprimir(Entidades.Álbum.Álbum álbum, ItensImpressão itens)
            using (PrintDocument documento = new PrintDocument())
                documento.DocumentName = "Álbum " + álbum.Nome;
                using (PrintDialog dlg = new PrintDialog())
                    dlg.AllowCurrentPage = false;
                    dlg.AllowSelection = false;
                    dlg.AllowSomePages = true;
                    dlg.UseEXDialog = true;
                    dlg.Document = documento;
                    if (dlg.ShowDialog() == DialogResult.OK)
                        ControleImpressão ctrl = new ControleImpressão(álbum, itens);
                        ctrl.página = new Página(
                                documento.PrinterSettings.DefaultPageSettings.PrintableArea.Width / 100f,
                                documento.PrinterSettings.DefaultPageSettings.PrintableArea.Height / 100f,
                                4, 5);
                        ctrl.daPágina = dlg.PrinterSettings.FromPage;
                        ctrl.atéPágina = dlg.PrinterSettings.ToPage != 0 ?
                            dlg.PrinterSettings.ToPage : int.MaxValue;
                        documento.PrintPage += new PrintPageEventHandler(ctrl.ImprimirPágina);
                        documento.Print();
        }
开发者ID:andrepontesmelo, 项目名称:imjoias, 代码行数:33, 代码来源: ControleImpressão.cs

示例13: button1_Click

 private void button1_Click(object sender, EventArgs e)
     PrintDocument pd = new PrintDocument();
         pd.PrintPage += PrintPage;
         pd.Print();
         this.Close();
 }
开发者ID:vivektarwan, 项目名称:JSSRISf, 代码行数:7, 代码来源: Printpatientinfo.cs

示例14: createXmlApp

        //如下的这个方法可以注释掉,没有任何的作用
        public void createXmlApp()
            // 首先创建文件
            FileStream fs = File.Create(Application.StartupPath + "\\xmlAPP.xml");
            fs.Close();//关闭文件
            //创建 XmlDocument 以便操作
            XmlDocument xmlDoc = new XmlDocument();
            //xml 唯一的根,我设置的根都是root
            XmlElement xmlEleRoot = xmlDoc.CreateElement("root");
            // 这个配置还有一个是必须的,就是打印机的DPI, 其他的都不是必要的
            XmlElement xmlElePrinter = xmlDoc.CreateElement("printer");
            //打印机名称,这里直接设置默认打印机
            PrintDocument printDoc = new PrintDocument();
            xmlElePrinter.SetAttribute("PrinterName", printDoc.PrinterSettings.PrinterName);
            printDoc.Dispose();//释放资源
            //DPI有两个
            xmlElePrinter.SetAttribute("DPIX", "600");
            xmlElePrinter.SetAttribute("DPIY", "600");
            //如下是两个添加操作了
            xmlEleRoot.AppendChild(xmlElePrinter);
            xmlDoc.AppendChild(xmlEleRoot);
            //保存操作
            xmlDoc.Save(Application.StartupPath + "\\xmlAPP.xml");
        }
开发者ID:kerwinxu, 项目名称:barcodeManager, 代码行数:32, 代码来源: ClsXmlAPP.cs

示例15: butPrint_Click

		private void butPrint_Click(object sender,EventArgs e) {
			PrintDocument pd2=new PrintDocument();
			pd2.PrintPage+=new PrintPageEventHandler(this.pd2_PrintPage);
			pd2.OriginAtMargins=true;
			pd2.DefaultPageSettings.Margins=new Margins(0,0,0,0);
			pd2.Print();
		}
开发者ID:romeroyonatan, 项目名称:opendental, 代码行数:7, 代码来源: FormPerioTest.cs

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