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


C# Forms.PageSetupDialog类代码示例

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


PageSetupDialog类属于System.Windows.Forms命名空间,在下文中一共展示了PageSetupDialog类的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;//横向打印
         }
         else
         {
             printdocument.DefaultPageSettings.Landscape = lendscape;//纵向打印
         }
     }
     pagesetupdialog.Document = printdocument;
     printdocument.PrintPage += new PrintPageEventHandler(this.printdocument_printpage);//事件的重载
 }
开发者ID:mahuidong,项目名称:c-1200-II,代码行数:31,代码来源:PrintClass.cs

示例2: DoPageSetup

        /// <summary>
        /// Display a <see cref="PageSetupDialog" /> to the user, allowing them to modify
        /// the print settings for this <see cref="ZedGraphControl" />.
        /// </summary>
        public void DoPageSetup()
        {
            PrintDocument pd = PrintDocument;

            // Add a try/catch pair since the users of the control can't catch this one
            try {
                if (pd != null) {
                    //pd.PrintPage += new PrintPageEventHandler( GraphPrintPage );
                    PageSetupDialog setupDlg = new PageSetupDialog();
                    setupDlg.Document = pd;

                    if (setupDlg.ShowDialog() == DialogResult.OK) {
                        pd.PrinterSettings = setupDlg.PrinterSettings;
                        pd.DefaultPageSettings = setupDlg.PageSettings;

                        // BUG in PrintDocument!!!  Converts in/mm repeatedly
                        // http://support.microsoft.com/?id=814355
                        // from http://www.vbinfozine.com/tpagesetupdialog.shtml, by Palo Mraz
                        //if ( System.Globalization.RegionInfo.CurrentRegion.IsMetric )
                        //{
                        //	setupDlg.Document.DefaultPageSettings.Margins = PrinterUnitConvert.Convert(
                        //	setupDlg.Document.DefaultPageSettings.Margins,
                        //	PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter );
                        //}
                    }
                }
            }

            catch (Exception exception) {
                MessageBox.Show(exception.Message);
            }
        }
开发者ID:Jchuchla,项目名称:vixen,代码行数:36,代码来源:ZedGraphControl.Printing.cs

示例3: ShowPageSetupDialog

		public DialogResult ShowPageSetupDialog()
		{
			PageSetupDialog psd = new PageSetupDialog();
			psd.PageSettings = PageSettings;
			psd.PrinterSettings = PageSettings.PrinterSettings;
			return psd.ShowDialog();
		}
开发者ID:dbbotkin,项目名称:PrimeComm,代码行数:7,代码来源:Printing.cs

示例4: Print_DataGridView

        public static void Print_DataGridView(DataGridView dgv1, string printTitle, bool printAllRows, bool fitToPageWidth)
        {
            PrintPreviewDialog ppvw;
            try
            {

                // Getting DataGridView object to print
                dgv = dgv1;

                // Getting all Coulmns Names in the DataGridView
                AvailableColumns.Clear();
                foreach (DataGridViewColumn c in dgv.Columns)
                {
                    if (!c.Visible) continue;
                    AvailableColumns.Add(c.HeaderText);
                }

                // Showing the PrintOption Form
                //PrintOptions dlg = new PrintOptions(AvailableColumns);
                //if (dlg.ShowDialog() != DialogResult.OK) return;

                PrintTitle = printTitle;
                PrintAllRows = printAllRows;
                FitToPageWidth = fitToPageWidth;
                SelectedColumns = AvailableColumns;

                RowsPerPage = 0;

                ppvw = new PrintPreviewDialog();
                PageSetupDialog psd = new PageSetupDialog();
                psd.Document = printDoc;
                psd.ShowDialog();
                printDoc.DefaultPageSettings = psd.PageSettings;
                ppvw.Document = printDoc;

                // Showing the Print Preview Page
                printDoc.BeginPrint += new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint);
                printDoc.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage);
                //printDoc.QueryPageSettings += new System.Drawing.Printing.QueryPageSettingsEventHandler(printDoc_QueryPageSettings);
                if (ppvw.ShowDialog() != DialogResult.OK)
                {
                    printDoc.BeginPrint -= new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint);
                    printDoc.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage);
                    return;
                }

                // Printing the Documnet
                printDoc.Print();
                printDoc.BeginPrint -= new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint);
                printDoc.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {

            }
        }
开发者ID:Avaruz,项目名称:Avaruz.FrameWork,代码行数:60,代码来源:PrintDV.cs

示例5: StartPrint

        //Stream streamToPrint, string streamType
        //2�����Print��ӡ����
        public void StartPrint()
        {
            //����ֵ��PageSettings A4\A5
            PageSettings ps = new PageSettings();
            //��ʾ���ô�ӡҳ�Ի���
            PageSetupDialog Psdl = new PageSetupDialog();
            //��ӡ������ã�ע�⣬�÷��������printpage�������档
            PrintDialog pt = new PrintDialog();
            pt.AllowCurrentPage = true;
            pt.AllowSomePages = true;
            pt.AllowPrintToFile = true;
            //       StreamToPrint = streamToPrint;//��ӡ���ֽ���
            //       StreamType = streamType; //��ӡ������
            //       printDocument1.DocumentName = Filename; //��ӡ���ļ���
            Psdl.Document = printDocument1;
            //       PrintPreview.Document = printDocument1;
            pt.Document = printDocument1;
            Psdl.PageSettings = printDocument1.DefaultPageSettings;
            try
            {
                //ҳ�����öԻ���
                if (Psdl.ShowDialog() == DialogResult.OK)
                {
                    ps = Psdl.PageSettings;
                    printDocument1.DefaultPageSettings = Psdl.PageSettings;
                }
                //ѡ���ӡ���Ի���
                if (pt.ShowDialog() == DialogResult.OK)
                {
                    printDocument1.PrinterSettings.Copies = pt.PrinterSettings.Copies;
                    //printDocument1.Print();
                    if (!checkBoxAll.Checked)
                    {
                        printDocument1.Print();
                    }
                    else
                    {
                        for (int i = 0; i < dataGridView1.RowCount; i++)
                        {
                            ShowTag(i);
                            printDocument1.Print();
                        }
                    }

                }
                ////��ӡԤ���Ի���
                //if (PrintPreview.ShowDialog() == DialogResult.OK)
                //{
                //    //���ô�ӡ
                //    printDocument1.Print();
                //}

                //PrintDocument�����Print()������PrintController����ִ��PrintPage�¼���
            }
            catch (InvalidPrinterException ex)
            {
                MessageBox.Show(ex.Message, "Simple Editor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw;
            }
        }
开发者ID:chutinhha,项目名称:asset-management-system,代码行数:62,代码来源:PrintDlg.cs

示例6: ShowPageSettingsDialog

 /// <summary>
 /// Shows the page settings dialog</summary>
 public void ShowPageSettingsDialog()
 {
     PageSetupDialog pageSetupDialog = new PageSetupDialog();
     PrintDocument printDocument = GetPrintDocument();
     pageSetupDialog.Document = printDocument;
     pageSetupDialog.ShowDialog();
 }
开发者ID:JanDeHud,项目名称:LevelEditor,代码行数:9,代码来源:StandardPrintCommands.cs

示例7: ShowPageSetupDialog

 public DialogResult ShowPageSetupDialog(ScintillaPrintDocument doc)
 {
     var psd = new PageSetupDialog();
     psd.AllowPrinter = true;
     psd.PageSettings = doc.DefaultPageSettings;
     psd.PrinterSettings = doc.DefaultPageSettings.PrinterSettings;
     return psd.ShowDialog(WB.Form);
 }
开发者ID:rizwan3d,项目名称:elalang,代码行数:8,代码来源:PrintService.cs

示例8: ShowPageSetupDialog

		public DialogResult ShowPageSetupDialog(IWin32Window owner)
		{
			PageSetupDialog psd = new PageSetupDialog();
			psd.AllowPrinter = true;
			psd.PageSettings = PageSettings;
			psd.PrinterSettings = PageSettings.PrinterSettings;

			return psd.ShowDialog(owner);
		}
开发者ID:erisonliang,项目名称:qizmt,代码行数:9,代码来源:Printing.cs

示例9: filePageSetupMenuItem_Click

 public void filePageSetupMenuItem_Click(Object sender, EventArgs e)
 {
     PageSetupDialog pageSetupDialog = new PageSetupDialog();
     pageSetupDialog.PageSettings = _pageSettings;
     pageSetupDialog.PrinterSettings = _printSettings;
     pageSetupDialog.AllowOrientation = true;
     pageSetupDialog.AllowMargins = true;
     pageSetupDialog.ShowDialog();
 }
开发者ID:sorvis,项目名称:Fast-Script,代码行数:9,代码来源:PagePrinter.cs

示例10: PageSetupDialog

 void IPrinter.ShowPageSettings()
 {
     PageSetupDialog pageSetupDialog = new PageSetupDialog();
     pageSetupDialog.PageSettings = pgSettings;
     pageSetupDialog.PrinterSettings = prtSettings;
     pageSetupDialog.AllowOrientation = true;
     pageSetupDialog.AllowMargins = true;
     pageSetupDialog.ShowDialog();
 }
开发者ID:k4gdw,项目名称:GSharpTools,代码行数:9,代码来源:TextPrinter.cs

示例11: InvoiceDocumentPrinter

        public InvoiceDocumentPrinter()
        {
            pDoc = new PrintDocument();
            pSDlg = new PageSetupDialog();
            pDlg = new PrintDialog();

            pDoc.PrintPage += new PrintPageEventHandler(print_material);
            pSDlg.Document = pDoc;
            pDlg.Document = pDoc;
        }
开发者ID:mikeyq6,项目名称:LabelPrintingSystem,代码行数:10,代码来源:InvoiceDocumentPrinter.cs

示例12: PageSetupButton_Click

        private void PageSetupButton_Click(object sender, EventArgs e)
        {
            PageSetupDialog pageSetupDialog = new PageSetupDialog();

            pageSetupDialog.PageSettings = m_DocumentPageSettings;

            if (pageSetupDialog.ShowDialog() == DialogResult.OK)
            {
                m_DocumentPageSettings = pageSetupDialog.PageSettings;
            }
        }
开发者ID:Digresiv,项目名称:garminworkouts,代码行数:11,代码来源:PrintOptionsDialog.cs

示例13: _btnPageSetup_Click

 private void _btnPageSetup_Click(object sender, EventArgs e)
 {
     using (PageSetupDialog dialog = new PageSetupDialog())
     {
         dialog.Document = this.Document;
         if (dialog.ShowDialog(this) == DialogResult.OK)
         {
             this._preview.method_2();
         }
     }
 }
开发者ID:windygu,项目名称:asxinyunet,代码行数:11,代码来源:CoolPrintPreviewDialog.cs

示例14: button3_Click

 private void button3_Click(object sender, EventArgs e)
 {
     PageSetupDialog pageSetupDialog = new PageSetupDialog();
     pageSetupDialog.PageSettings = pgSettings;
     pageSetupDialog.PrinterSettings = prtSettings;
     pageSetupDialog.AllowOrientation = true;
     pageSetupDialog.AllowMargins = true;
     pageSetupDialog.ShowDialog();
     pd.PrinterSettings = prtSettings;
     pd.DefaultPageSettings = pgSettings;
 }
开发者ID:vmykh,项目名称:printer_labs,代码行数:11,代码来源:Form1.cs

示例15: Install

    public static void Install ()
    { PrintDoc = new PrintDocument () ;

      SetupDlg = new PageSetupDialog () ;
      PreviewDlg = new PrintPreviewDialog () ;
      PrintDlg = new PrintDialog () ;

      SetupDlg.Document = PrintDoc ;
      PreviewDlg.Document = PrintDoc ;
      PrintDlg.Document = PrintDoc ;

      PrintDoc.PrintPage += new PrintPageEventHandler (OnPrintPage) ;
    }
开发者ID:kcb146,项目名称:editor,代码行数:13,代码来源:Print_Manager.CS


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