當前位置: 首頁>>代碼示例>>C#>>正文


C# Printing.PageSettings類代碼示例

本文整理匯總了C#中System.Drawing.Printing.PageSettings的典型用法代碼示例。如果您正苦於以下問題:C# PageSettings類的具體用法?C# PageSettings怎麽用?C# PageSettings使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PageSettings類屬於System.Drawing.Printing命名空間,在下文中一共展示了PageSettings類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CloneTest

		public void CloneTest ()
		{
			// Check for installed printers, because we need
			// to have at least one to test
			if (PrinterSettings.InstalledPrinters.Count == 0)
				Assert.Ignore ("No printers found.");

			PageSettings ps = new PageSettings ();
			ps.Color = false;
			ps.Landscape = true;
			ps.Margins = new Margins (120, 130, 140, 150);
			ps.PaperSize = new PaperSize ("My Custom Size", 222, 333);
			PageSettings clone = (PageSettings) ps.Clone ();

			Assert.AreEqual (ps.Color, clone.Color, "#1");
			Assert.AreEqual (ps.Landscape, clone.Landscape, "#2");
			Assert.AreEqual (ps.Margins, clone.Margins, "#3");
			Assert.AreSame (ps.PrinterSettings, clone.PrinterSettings, "#4");

			// PaperSize
			Assert.AreEqual (ps.PaperSize.PaperName, clone.PaperSize.PaperName, "#5");
			Assert.AreEqual (ps.PaperSize.Width, clone.PaperSize.Width, "#6");
			Assert.AreEqual (ps.PaperSize.Height, clone.PaperSize.Height, "#7");
			Assert.AreEqual (ps.PaperSize.Kind, clone.PaperSize.Kind, "#8");

			// PrinterResolution
			Assert.AreEqual (ps.PrinterResolution.X, clone.PrinterResolution.X, "#9");
			Assert.AreEqual (ps.PrinterResolution.Y, clone.PrinterResolution.Y, "#10");
			Assert.AreEqual (ps.PrinterResolution.Kind, clone.PrinterResolution.Kind, "#11");

			// PaperSource
			Assert.AreEqual (ps.PaperSource.Kind, clone.PaperSource.Kind, "#12");
			Assert.AreEqual (ps.PaperSource.SourceName, clone.PaperSource.SourceName, "#13");
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:34,代碼來源:PageSettingsTest.cs

示例2: ItopVectorControl

 public ItopVectorControl()
 {
     //int num1;
     this.components = null;
     this.pageSetting=new PageSettings();
     this.svgDocument = new SvgDocument();
     this.mainIcon = null;
     this.roots = new Hashtable(0x10);
     this.unnamed = string.Empty;
     this.InitializeComponent();
     this.mainIcon = this.GetIconFromResource(base.GetType(), "ItopVector.ItopVectorControl.Resource.main.ico");
     this.CreateMenu();
     this.drawArea1.OperationChanged += new EventHandler(this.ChangeOperation);
     this.drawArea1.ScaleChanged += new EventHandler(this.ChangeScale);
     this.drawArea1.OnTrackPopup += new TrackPopupEventHandler(this.TrackPopup);
     this.drawArea1.OnTipEvent += new OnTipEventHandler(this.ToolTip);
     this.drawArea1.PostBrushEvent += new PostBrushEventHandler(this.PostBrush);
     this.drawArea1.LeftClick +=new SvgElementEventHandler(drawArea1_LeftClick);
     this.drawArea1.DoubleLeftClick+=new SvgElementEventHandler(drawArea1_DoubleLeftClick);
     this.drawArea1.RightClick+=new SvgElementEventHandler(drawArea1_RightClick);
     this.drawArea1.MoveOver+=new SvgElementEventHandler(drawArea1_MoveOver);
     this.drawArea1.MoveIn+=new SvgElementEventHandler(drawArea1_MoveIn);
     this.drawArea1.MoveOut+=new SvgElementEventHandler(drawArea1_MoveOut);
     this.drawArea1.DragAndDrop+=new DragEventHandler(drawArea1_DragDrop);
     this.drawArea1.PaintMap+=new PaintMapEventHandler(drawArea1_PaintMap);
     this.drawArea1.AfterPaintPage+=new PaintMapEventHandler(drawArea1_AfterPaintPage);
     this.Disposed+=new EventHandler(DocumentControl_Disposed);
     this.UpdateProperty();
     this.unnamed = ItopVector.Resource.LayoutManager.GetLabelForName("unnamedelement").Trim();
     this.drawArea1.OnMouseUp += new MouseEventHandler(drawArea1_OnMouseUp);
 }
開發者ID:EdgarEDT,項目名稱:myitoppsp,代碼行數:31,代碼來源:TLVectorControl.cs

示例3: PrintPageEventArgs

		public PrintPageEventArgs(Graphics graphics, Rectangle marginBounds,
			Rectangle pageBounds, PageSettings pageSettings) {
			this.graphics = graphics;
			this.marginBounds = marginBounds;
			this.pageBounds = pageBounds;
			this.pageSettings = pageSettings;
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:7,代碼來源:PrintPageEventArgs.cs

示例4: 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

示例5: Payments_Full_Report_Load

        private void Payments_Full_Report_Load(object sender, EventArgs e)
        {
            ReportDataSource ds = new ReportDataSource();
            ds.Name = "DataSet1";
            ds.Value = GeneratePaymentData();

            this.reportViewer1.ProcessingMode = ProcessingMode.Local;
            this.reportViewer1.LocalReport.ReportPath = @"Report5.rdlc";
            this.reportViewer1.LocalReport.DataSources.Add(ds);

            System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();
            pg.Margins.Top = 0;
            pg.Landscape = true;
            pg.Margins.Bottom = 0;
            pg.Margins.Left = 50;
            pg.Margins.Right = 0;

            System.Drawing.Printing.PaperSize size = new PaperSize();
            size.RawKind = (int)PaperKind.A4;
            pg.PaperSize = size;
            pg.Landscape = true;

            this.reportViewer1.SetPageSettings(pg);
            this.reportViewer1.RefreshReport();
        }
開發者ID:CRISTELSoftware,項目名稱:CRISTEL-DHANULA,代碼行數:25,代碼來源:Payments_Full_Report.cs

示例6: GdiPrinterPrintAction

        private bool GdiPrinterPrintAction(int pageIndex, Graphics graphics, Rectangle marginBounds, Rectangle pageBounds, PageSettings pageSettings, ref object state)
        {
            pageSettings.Landscape = false;

            Image renderedImage = state as Image;
            if (renderedImage == null)
            {
                // Store the whole rendered image and share it across multiple pages.
                Size renderBounds = new Size(pageBounds.Width, 0);

                string templateFile = GetTemplateFile();
                if (templateFile == null)
                {
                    return false;
                }

                renderedImage = TemplateRenderer.RenderOperation(GetSourceLocation(), _operation, templateFile, renderBounds);
                state = renderedImage;
            }

            // Calculate the source rectangle (the portion of the rendered image) depending on which page we are in.
            int pagesNeeded = (int)Math.Ceiling((double)renderedImage.Height / (double)pageBounds.Size.Height);
            Rectangle destRect = pageBounds;
            Rectangle srcRect = new Rectangle(0, pageBounds.Height * (pageIndex - 1), pageBounds.Width, pageBounds.Height);

            graphics.DrawImage(renderedImage, destRect, srcRect, GraphicsUnit.Pixel);

            return pageIndex < pagesNeeded;
        }
開發者ID:huoxudong125,項目名稱:AlarmWorkflow,代碼行數:29,代碼來源:OperationPrinterJob.cs

示例7: loadReport

        public void loadReport()
        {
            /*
            // file ini disimpan di bin/debug
            m_cryRpt.Load(Application.StartupPath + @".\REPORT\RESI.rpt");
            // cara pemanggilan menggunakan data table yang sudah di proses dan di masukan ke object dt
            m_cryRpt.Database.Tables[0].SetDataSource((DataTable)my_dt);
            // data yang di panggil di ke data source otomatis tergambar ke dataset yang di buat dan berextensi xsd
            crystalReportViewerRESI.ReportSource = m_cryRpt;
            crystalReportViewerRESI.Refresh();
             */
            reportViewerCETAKRESI.LocalReport.DataSources.Clear();
            reportViewerCETAKRESI.LocalReport.ReportEmbeddedResource = "LOGISTICMANAGAMENTSYSTEM.REPORTS.EXPRESS.cetakRESI.rdlc";
            Microsoft.Reporting.WinForms.ReportDataSource dataset = new Microsoft.Reporting.WinForms.ReportDataSource("dsRESI_V_TRANSAKSIEXPRESS", my_dt); // set the datasource
            reportViewerCETAKRESI.LocalReport.DataSources.Add(dataset);
            dataset.Value = my_dt;
            System.Drawing.Printing.PageSettings pg = new PageSettings();
            // Set margins
            // Set paper size
            pg.Margins.Top = 100;
            pg.Margins.Bottom = 100;
            pg.Margins.Left = 100;
            pg.Margins.Right = 100;
            pg.Landscape = false;
            System.Drawing.Printing.PaperSize size = new PaperSize();
            size.RawKind = (int)PaperKind.A4;
            pg.PaperSize = size;

               // reportViewerCETAKRESI.SetPageSettings(pg); ??
            reportViewerCETAKRESI.LocalReport.Refresh();
            reportViewerCETAKRESI.RefreshReport(); // refresh report
        }
開發者ID:rhizalpatrax64bit,項目名稱:logistic-management-system,代碼行數:32,代碼來源:FormRESIEXPRESS.cs

示例8: PrintForm

 public PrintForm(PageSettings e)
 {
     InitializeComponent();
     this.IsAccessible = false;
     InitPrintForm();
     _settings = e;
 }
開發者ID:JosonYang,項目名稱:aojreporter,代碼行數:7,代碼來源:PrintForm.cs

示例9: PrintDocument

	// Constructor.
	public PrintDocument()
			{
				this.documentName = "document";
				this.originAtMargins = false;
				this.printController = null;
				this.printerSettings = new PrinterSettings();
				this.defaultPageSettings = new PageSettings(printerSettings);
			}
開發者ID:jjenki11,項目名稱:blaze-chem-rendering,代碼行數:9,代碼來源:PrintDocument.cs

示例10: FromPrinter

		public static Graphics FromPrinter (PageSettings page)
		{
			if (page == null) {
				throw new ArgumentNullException("page");
			}
			Graphics test = page.PrinterSettings.CreateMeasurementGraphics();
			return test;
		}
開發者ID:Rpinski,項目名稱:SharpDevelop,代碼行數:8,代碼來源:CreateGraphicObject.cs

示例11: GetPrintableArea

 RectangleF GetPrintableArea(PageSettings pageSettings)
 {
     // Get the available page size on the page. Note the PrintableArea member of PageSettings does not automatically does the
     // landscape into account.
     RectangleF printableArea = pageSettings.PrintableArea;
     if (pageSettings.Landscape)
         printableArea = new RectangleF(printableArea.Top, printableArea.Left, printableArea.Height, printableArea.Width);  // reverse rectangle for landscape
     return printableArea;
 }
開發者ID:petergolde,項目名稱:PurplePen,代碼行數:9,代碼來源:CoursePrinting.cs

示例12: PrintEngine

 public PrintEngine()
 {
     _pageSettings = new PageSettings();
     _pageSettings.Landscape = true;
     _pageSettings.Margins.Top = 50;
     _pageSettings.Margins.Bottom = 50;
     _pageSettings.Margins.Left = 50;
     _pageSettings.Margins.Right = 50;
     _printerSettings = new PrinterSettings();
 }
開發者ID:KindDragon,項目名稱:ICSharpCode.TextEditor.V4,代碼行數:10,代碼來源:PrintEngine.cs

示例13: 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

示例14: ReportPrintDocument

        private ReportPrintDocument(Microsoft.Reporting.WinForms.Report report)
        {
            // Set the page settings to the default defined in the report
            ReportPageSettings reportPageSettings = report.GetDefaultPageSettings();

            // The page settings object will use the default printer unless
            // PageSettings.PrinterSettings is changed.  This assumes there
            // is a default printer.
            m_pageSettings = new PageSettings();
            m_pageSettings.PaperSize = reportPageSettings.PaperSize;
            m_pageSettings.Margins = reportPageSettings.Margins;
        }
開發者ID:Leonoo,項目名稱:CleanEstimate,代碼行數:12,代碼來源:ReportPrintDocument.cs

示例15: AutoPrintCls

        //public AutoPrintCls(ServerReport serverReport)
        //    : this((Report)serverReport)
        //{
        //    RenderAllServerReportPages(serverReport);
        //}
        //public AutoPrintCls(LocalReport localReport)
        //    : this((Report)localReport)
        //{
        //    RenderAllLocalReportPages(localReport);
        //}
        private AutoPrintCls(LocalReport report)
        {
            // Set the page settings to the default defined in the report
            ReportPageSettings reportPageSettings = report.GetDefaultPageSettings();

            // The page settings object will use the default printer unless
            // PageSettings.PrinterSettings is changed.  This assumes there
            // is a default printer.
            m_pageSettings = new PageSettings();
            m_pageSettings.PaperSize = reportPageSettings.PaperSize;
            m_pageSettings.Margins = reportPageSettings.Margins;
        }
開發者ID:ranyaof,項目名稱:ongaz,代碼行數:22,代碼來源:AutoPrintBase.cs


注:本文中的System.Drawing.Printing.PageSettings類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。