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


C# PrintDocument.DefaultPageSettings属性代码示例

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


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

示例1: Printing

public void Printing()
{
   try
   {
      streamToPrint = new StreamReader (filePath);
      try
      {
         printFont = new Font("Arial", 10);
         PrintDocument pd = new PrintDocument(); 
         pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
         pd.PrinterSettings.PrinterName = printer;
         // Set the page orientation to landscape.
         pd.DefaultPageSettings.Landscape = true;
         pd.Print();
      } 
      finally
      {
         streamToPrint.Close() ;
      }
   } 
   catch(Exception ex)
   { 
      MessageBox.Show(ex.Message);
   }
}
开发者ID:.NET开发者,项目名称:System.Drawing.Printing,代码行数:25,代码来源:PrintDocument.DefaultPageSettings

示例2: Main

//引入命名空间
using System;
using System.Drawing.Printing;

namespace DefPrintSettings_c
{
    public class DefPrintSettings
    {
        [STAThread]
        static void Main(string[] args)
        {
      PrintDocument pd = new PrintDocument();
      PageSettings pg = pd.DefaultPageSettings;
      PrinterSettings ps = pg.PrinterSettings;

      Console.WriteLine("Printer Settings");
      Console.WriteLine("PrinterName = " + pd.PrinterSettings.PrinterName);
      Console.WriteLine("Is default Printer = " +
                         ps.IsDefaultPrinter.ToString());
      Console.WriteLine("Is plotter = " + ps.IsPlotter.ToString());
      Console.WriteLine("Is printer valid = " + ps.IsValid.ToString());
      Console.WriteLine("Can Duplex = " + ps.IsValid.ToString());
      Console.WriteLine("Num copies = " + ps.Copies.ToString());
      Console.WriteLine("Max Copies = " + ps.MaximumCopies.ToString());
      Console.WriteLine("Max Page = " + ps.MaximumPage.ToString());
      Console.WriteLine("Min Page = " + ps.MinimumPage.ToString());
      Console.WriteLine("Supports Color = " + ps.SupportsColor.ToString());
      foreach (PaperSize p in ps.PaperSizes)
        Console.WriteLine("Supports Paper Size: " + p.PaperName);
      foreach (PaperSource p in ps.PaperSources)
        Console.WriteLine("Supports Paper Source: " + p.SourceName);

      Console.WriteLine("\nPage Settings");
      Console.WriteLine("Is Color = " + pg.Color.ToString());
      Console.WriteLine("Top Bound = " + pg.Bounds.Top.ToString());
      Console.WriteLine("Bottom Bound = " + pg.Bounds.Bottom.ToString());
      Console.WriteLine("Left Bound = " + pg.Bounds.Left.ToString());
      Console.WriteLine("Right Bound = " + pg.Bounds.Right.ToString());
      Console.WriteLine("Top Margin = " + pg.Margins.Top.ToString());
      Console.WriteLine("Bottom Margin = " + pg.Margins.Bottom.ToString());
      Console.WriteLine("Left Margin = " + pg.Margins.Left.ToString());
      Console.WriteLine("Right Margin = " + pg.Margins.Right.ToString());
      Console.WriteLine("Landscape = " + pg.Landscape.ToString());
      Console.WriteLine("PaperSize = " + pg.PaperSize.PaperName);
      Console.WriteLine("PaperSource = " + pg.PaperSource.SourceName);
      Console.WriteLine("PrinterResolution = " + 
                        pg.PrinterResolution.Kind.ToString());
      Console.WriteLine("PrinterResolution X = " + 
                        pg.PrinterResolution.X.ToString());
      Console.WriteLine("PrinterResolution Y = " + 
                        pg.PrinterResolution.Y.ToString());

      Console.ReadLine();

    }
    }
}
开发者ID:C#程序员,项目名称:System.Drawing.Printing,代码行数:57,代码来源:PrintDocument.DefaultPageSettings


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