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


C# PrintPreviewDialog.Dispose方法代码示例

本文整理汇总了C#中System.Windows.Forms.PrintPreviewDialog.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# PrintPreviewDialog.Dispose方法的具体用法?C# PrintPreviewDialog.Dispose怎么用?C# PrintPreviewDialog.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.PrintPreviewDialog的用法示例。


在下文中一共展示了PrintPreviewDialog.Dispose方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: button2_Click

 private void button2_Click(object sender, System.EventArgs e)
 {
     pd = new PrintDocument();
     pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
     pd.PrinterSettings.PrinterName = "PDFCreator";
     pd.DocumentName = "PDFCreator Dot Net - Sample2";
     PrintPreviewDialog ppdlg = new PrintPreviewDialog();
     ppdlg.Document = pd;
     ppdlg.WindowState = FormWindowState.Maximized;
     ppdlg.ShowDialog();
     ppdlg.Dispose();
 }
开发者ID:trincio,项目名称:pdfcreator,代码行数:12,代码来源:Form1.cs

示例2: Run

 public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
 {
   try
   {
     System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog();
     Current.PrintingService.PrintDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(ctrl.EhPrintPage);
     dlg.Document = Current.PrintingService.PrintDocument;
     dlg.ShowDialog(ctrl.View.Form);
     dlg.Dispose();
   }
   catch(Exception ex)
   {
     System.Windows.Forms.MessageBox.Show(ctrl.View.Form,ex.ToString());
   }
   finally
   {
     Current.PrintingService.PrintDocument.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(ctrl.EhPrintPage);
   }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:19,代码来源:GraphCommands.cs

示例3: dataGridView_print

 public void dataGridView_print()
 {
     PrintPreviewDialog ppvw = new PrintPreviewDialog();
     ppvw.Document = myDocument;
     //GetPageSum();
     //ppvw.ShowDialog();·
     myDocument.BeginPrint += new PrintEventHandler(myDocument_BeginPrint);
     myDocument.PrintPage += new PrintPageEventHandler(myDocument_PrintPage);
     if (ppvw.ShowDialog() == DialogResult.OK)
     {
         myDocument.Print();
     }
     else
     {
         myDocument.BeginPrint -= new PrintEventHandler(myDocument_BeginPrint);
         myDocument.PrintPage -= new PrintPageEventHandler(myDocument_PrintPage);
         ppvw.Dispose();
         return;
     }
     myDocument.BeginPrint -= new PrintEventHandler(myDocument_BeginPrint);
     myDocument.PrintPage -= new PrintPageEventHandler(myDocument_PrintPage);
 }
开发者ID:ZoeCheck,项目名称:DayReport_JieGou,代码行数:22,代码来源:PrintCzlt.cs

示例4: ShowPrintPreviewDialog

 public override bool ShowPrintPreviewDialog(PrintPageEventHandler printPageEventHandler, QueryPageSettingsEventHandler queryPageSettingsEventHandler)
 {
   try
   {
     System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog();
     Current.PrintingService.PrintDocument.PrintPage += printPageEventHandler;
     Current.PrintingService.PrintDocument.QueryPageSettings += queryPageSettingsEventHandler;
     dlg.Document = Current.PrintingService.PrintDocument;
     dlg.ShowDialog(MainWindow);
     dlg.Dispose();
     return true;
   }
   catch (Exception ex)
   {
     Current.Gui.ErrorMessageBox(ex.ToString());
   }
   finally
   {
     Current.PrintingService.PrintDocument.PrintPage -= printPageEventHandler;
     Current.PrintingService.PrintDocument.QueryPageSettings -= queryPageSettingsEventHandler;
   }
   return false;
 }
开发者ID:Altaxo,项目名称:Altaxo,代码行数:23,代码来源:WinFormsGuiFactoryService.cs

示例5: EhMenuFilePrintPreview_OnClick

 /// <summary>
 /// Handler for the menu item "File" - "Print Preview".
 /// </summary>
 /// <param name="sender">Not used.</param>
 /// <param name="e">Not used.</param>
 private void EhMenuFilePrintPreview_OnClick(object sender, System.EventArgs e)
 {
   try
   {
     System.Windows.Forms.PrintPreviewDialog dlg = new System.Windows.Forms.PrintPreviewDialog();
     Current.PrintingService.PrintDocument.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.EhPrintPage);
     dlg.Document = Current.PrintingService.PrintDocument;
     dlg.ShowDialog(this.m_View.Window);
     dlg.Dispose();
   }
   catch(Exception ex)
   {
     System.Windows.Forms.MessageBox.Show(this.m_View.Window,ex.ToString());
   }
   finally
   {
     Current.PrintingService.PrintDocument.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(this.EhPrintPage);
   }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:24,代码来源:GraphController.cs

示例6: PrintOrPreview

        public void PrintOrPreview(CharsPerLine CPL,
			string PPrintBlock, string PTitle,
			string PSubTitle, PrintPreview PVOption,
			PrintOrientation Layout,string ColHdr1,string ColHdr2,
			string ColHdr3,string ColHdr4)
        {
            PrintPreviewDialog previewDialog;
            tbm = new TBMemoLine();
            Portrait =(Layout==PrintOrientation.Portrait);
            msRptString=PPrintBlock;
            _Title = PTitle;
            _SubTitle=PSubTitle;
            SetUpColHdrArray(ColHdr1,ColHdr2,ColHdr3,ColHdr4);
            miChrPerLine=(int) CPL;
            // create two memoline objects so that we can use
            // nested calls to memoline w/o stepping
            // on each other, used only when wordwrap is on

            if (sFooter.Length == 0)
            {
                sFooter = "Printed on: " + DateTime.Now.ToString();
            }

            // chars per line will vary based on the margins
            switch (CPL)
            {
                case CharsPerLine.CPL80:
                    DetailFontSize = DETAIL_FONT_SIZE_80;
                    break;
                case CharsPerLine.CPL96:
                    DetailFontSize = DETAIL_FONT_SIZE_96;
                    break;
                case CharsPerLine.CPL120:
                    DetailFontSize = DETAIL_FONT_SIZE_120;
                    break;
                case CharsPerLine.CPL160:
                    DetailFontSize = DETAIL_FONT_SIZE_160;
                    break;
                default:
                    throw new System.Exception("Invalid CharsPerLine parameter");
            }

            // set up memoline
            miNL = tbm.MLCount(msRptString);
            if(miNL==0)
            {
                MessageBox.Show("No lines to print in report string.");
                return;
            }

            mI=0;
            PrintDoc = new PrintDocument();
            PrintDoc.PrintPage += new PrintPageEventHandler(this.OnPrintPage);
            PrintDoc.DefaultPageSettings.Landscape=(Layout == PrintOrientation.Landscape);
            PrintDoc.DocumentName=_Title;

            if(PVOption == PrintPreview.Preview)
            {
                previewDialog = new PrintPreviewDialog();
                previewDialog.Document = PrintDoc;
                previewDialog.ShowDialog();
                previewDialog.Dispose();
            }
            else
                PrintDoc.Print();
        }
开发者ID:COliver988,项目名称:Traveller,代码行数:66,代码来源:CPrintReportString.cs

示例7: PrintPreview

        // Do a print preview of the descriptions.
        public void PrintPreview(Size dialogSize)
        {
            // Set up and position everything.
            SetupPrinting();
            printPreviewInProgress = true;

            using (PrintDocument printDocument = CreatePrintDocument()) {
                PrintPreviewDialog dialog = new PrintPreviewDialog();
                dialog.UseAntiAlias = true;
                dialog.Document = printDocument;
                dialog.StartPosition = FormStartPosition.CenterParent;
                dialog.Size = dialogSize;
                dialog.SizeGripStyle = SizeGripStyle.Show;
                dialog.ShowIcon = false;

                // Remove the "print" button.
                foreach (Control ctl in dialog.Controls) {
                    ToolStrip strip = ctl as ToolStrip;
                    if (strip != null) {
                        var button = strip.Items[0];
                        if (button.Name == "printToolStripButton")
                            strip.Items.Remove(button);
                    }
                }

                dialog.ShowDialog();
                dialog.Dispose();
            }
        }
开发者ID:petergolde,项目名称:PurplePen,代码行数:30,代码来源:BasicPrinting.cs

示例8: PrinterSetting

        public void PrinterSetting()
        {
            PrintDialog pDlg = new PrintDialog();
            PrintPreviewDialog ppDlg = new PrintPreviewDialog();
            try
            {
                //��������ֵ��PrinterSettings
                PrinterSettings ps = new PrinterSettings();

                //����ѡ��ҳ
                pDlg.AllowSomePages = true;

                //ָ����ӡ�ĵ�
                pDlg.Document = document;

                //��ʾ�Ի���
                DialogResult result = pDlg.ShowDialog();
                if (result == DialogResult.OK)
                {
                    //�����ӡ����
                    ps = pDlg.PrinterSettings;

                    ppDlg.Text = "��ӡԤ��";
                    ppDlg.WindowState = FormWindowState.Maximized;
                    ppDlg.PrintPreviewControl.Zoom = 1;
                    //ָ����ӡ�ĵ�
                    ppDlg.Document = document;
                    ppDlg.ShowDialog();
                }

            }
            catch (System.Drawing.Printing.InvalidPrinterException e)
            {
                MessageBox.Show("�����ڿ��������Ӵ�ӡ��!", "δ�ҵ���ӡ��");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "��ӡ����");
            }
            finally
            {
                pDlg.Dispose();
                pDlg = null;
                ppDlg.Dispose();
                ppDlg = null;
            }
        }
开发者ID:romanu6891,项目名称:fivemen,代码行数:47,代码来源:PrinterContent.cs

示例9: Preview

        public void Preview()
        {
            PrintPreviewDialog ppDlg = new PrintPreviewDialog();
            try
            {

                ppDlg.Text = "��ӡԤ��";
                ppDlg.WindowState = FormWindowState.Maximized;
                ppDlg.PrintPreviewControl.Zoom = 1;
                //ָ����ӡ�ĵ�
                ppDlg.Document = document;

                //��ʾ�Ի���
                //				ppDlg.FindForm().Visible = false;

                DialogResult result = ppDlg.ShowDialog();

                //				ppDlg.FindForm().Visible = true;
                if (result == DialogResult.OK)
                {
                    //...
                }

            }
            catch (System.Drawing.Printing.InvalidPrinterException e)
            {
                MessageBox.Show("�����ڿ��������Ӵ�ӡ��!", "δ�ҵ���ӡ��");
                //ShowInvalidPrinterException(e);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "��ӡ����");
            }
            finally
            {
                ppDlg.Dispose();
                ppDlg = null;
            }
        }
开发者ID:romanu6891,项目名称:fivemen,代码行数:39,代码来源:PrinterContent.cs


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