PrinterSettingsとは? わかりやすく解説

PrinterSettings クラス

ドキュメント印刷方法に関する情報 (印刷使用するプリンタなど) を指定します

名前空間: System.Drawing.Printing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

<SerializableAttribute> _
Public Class PrinterSettings
    Implements ICloneable
Dim instance As PrinterSettings
[SerializableAttribute] 
public class PrinterSettings : ICloneable
[SerializableAttribute] 
public ref class PrinterSettings : ICloneable
/** @attribute SerializableAttribute() */ 
public class PrinterSettings implements ICloneable
SerializableAttribute 
public class PrinterSettings implements ICloneable
解説解説

通常、PrintDocument.PrinterSettings プロパティまたは PageSettings.PrinterSettings プロパティ使用して PrinterSettingsアクセスし、プリンタ設定変更します。最も一般的なプリンタ設定は、印刷するプリンタ指定する PrinterName です。

印刷詳細については、System.Drawing.Printing 名前空間概要トピック参照してください

使用例使用例

指定したプリンタ上でドキュメント印刷するコード例次に示します。この例には、次の 3 つの必要条件あります

この例では、System.DrawingSystem.Drawing.Printing、および System.IO の各名前空間使用します

Public Sub Printing(printer As
 String)
    Try
        streamToPrint = New StreamReader(filePath)
        Try
            printFont = New Font("Arial",
 10)
            Dim pd As New
 PrintDocument()
            AddHandler pd.PrintPage, AddressOf
 pd_PrintPage
            ' Specify the printer to use.
            pd.PrinterSettings.PrinterName = printer

            If pd.PrinterSettings.IsValid then
               pd.Print()
            Else
               MessageBox.Show("Printer is invalid.")
            End If
        Finally
            streamToPrint.Close()
        End Try
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try
End Sub
   
public void Printing(string
 printer) {
  try {
    streamToPrint = new StreamReader (filePath);
    try {
      printFont = new Font("Arial", 10);
      PrintDocument pd = new PrintDocument(); 
      pd.PrintPage += new PrintPageEventHandler(pd_PrintPage);
      // Specify the printer to use.
      pd.PrinterSettings.PrinterName = printer;

      if (pd.PrinterSettings.IsValid) {
         pd.Print();
      } 
      else {    
         MessageBox.Show("Printer is invalid.");
      }
    } 
    finally {
      streamToPrint.Close();
    }
  } 
  catch(Exception ex) {
    MessageBox.Show(ex.Message);
  }
}

public:
   void Printing( String^ printer )
   {
      try
      {
         streamToPrint = gcnew StreamReader( filePath );
         try
         {
            printFont = gcnew System::Drawing::Font( "Arial",10 );
            PrintDocument^ pd = gcnew PrintDocument;
            pd->PrintPage += gcnew PrintPageEventHandler(
               this, &Form1::pd_PrintPage );
            // Specify the printer to use.
            pd->PrinterSettings->PrinterName = printer;
            if ( pd->PrinterSettings->IsValid )
            {
               pd->Print();
            }
            else
            {
               MessageBox::Show( "Printer is invalid." );
            }
         }
         finally
         {
            streamToPrint->Close();
         }
      }
      catch ( Exception^ ex ) 
      {
         MessageBox::Show( ex->Message );
      }
   }
public void Printing(String printer)
{
    try {
        streamToPrint = new StreamReader(filePath);
        try {
            printFont = new Font("Arial", 10);
            PrintDocument pd = new PrintDocument();
            pd.add_PrintPage(new PrintPageEventHandler(pd_PrintPage));

            // Specify the printer to use.
            pd.get_PrinterSettings().set_PrinterName(printer);
            if (pd.get_PrinterSettings().get_IsValid()) {
                pd.Print();
            }
            else {
                MessageBox.Show("Printer is invalid.");
            }
        }
        finally {
            streamToPrint.Close();
        }
    }
    catch (System.Exception ex) {
        MessageBox.Show(ex.get_Message());
    }
} //Printing
継承階層継承階層
System.Object
  System.Drawing.Printing.PrinterSettings
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
PrinterSettings メンバ
System.Drawing.Printing 名前空間
PrinterName
PrintDocument.PrinterSettings プロパティ
PageSettings.PrinterSettings プロパティ

PrinterSettings コンストラクタ


PrinterSettings プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ IsDefaultPrinter ユーザー明示的に PrinterName を設定した場合除きPrinterName プロパティが、通常使うプリンタ指定されているかどうかを示す値を取得します
パブリック プロパティ IsPlotter プリンタプロッタかどうかを示す値を取得します
パブリック プロパティ IsValid PrinterName プロパティ有効なプリンタ指定されているかどうかを示す値を取得します
パブリック プロパティ LandscapeAngle 向き用紙回転して横向きにする場合角度 (°) を取得します
パブリック プロパティ MaximumCopies プリンタ一度印刷できる最大部数取得します
パブリック プロパティ MaximumPage PrintDialog で選択できる FromPage または ToPage の最大値取得または設定します
パブリック プロパティ MinimumPage PrintDialog選択できる FromPage または ToPage最小値取得または設定します
パブリック プロパティ PaperSizes プリンタサポートされている用紙サイズ取得します
パブリック プロパティ PaperSources プリンタ使用できる用紙トレイ取得します
パブリック プロパティ PrinterName 使用するプリンタの名前を取得または設定します
パブリック プロパティ PrinterResolutions プリンタサポートされている解像度をすべて取得します
パブリック プロパティ PrintFileName ファイル出力する際にファイル名取得または設定します
パブリック プロパティ PrintRange ユーザー指定した印刷ページ番号取得または設定します
パブリック プロパティ PrintToFile ポートではなくファイル印刷出力送信するかどうかを示す値を取得または設定します
パブリック プロパティ SupportsColor プリンタカラー印刷サポートしているかどうかを示す値を取得します
パブリック プロパティ ToPage 印刷終了ページ番号取得または設定します
参照参照

関連項目

PrinterSettings クラス
System.Drawing.Printing 名前空間
PrinterName
PrintDocument.PrinterSettings プロパティ
PageSettings.PrinterSettings プロパティ

PrinterSettings メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Clone この PrinterSettings のコピー作成します
パブリック メソッド CreateMeasurementGraphics オーバーロードされますプリンタ情報格納する Graphics返します
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 ( Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 ( Object から継承されます。)
パブリック メソッド GetHdevmode オーバーロードされますプリンタ設定対応する DEVMODE 構造体識別するハンドル作成します
パブリック メソッド GetHdevnames プリンタ設定対応する DEVNAMES 構造体識別するハンドル作成します
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド IsDirectPrintingSupported オーバーロードされますイメージ ファイル印刷プリンタサポートしているかどうかを示す値を返します
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド SetHdevmode 特定のハンドルから PrinterSettings関連情報コピーします
パブリック メソッド SetHdevnames 特定のハンドルから PrinterSettings関連情報コピーします
パブリック メソッド ToString オーバーライドされますPrinterSettings に関する情報文字列形式提供します
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

PrinterSettings クラス
System.Drawing.Printing 名前空間
PrinterName
PrintDocument.PrinterSettings プロパティ
PageSettings.PrinterSettings プロパティ

PrinterSettings メンバ

ドキュメント印刷方法に関する情報 (印刷使用するプリンタなど) を指定します

PrinterSettings データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド PrinterSettings PrinterSettings クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ IsDefaultPrinter ユーザー明示的に PrinterName を設定した場合除きPrinterName プロパティが、通常使うプリンタ指定されているかどうかを示す値を取得します
パブリック プロパティ IsPlotter プリンタプロッタかどうかを示す値を取得します
パブリック プロパティ IsValid PrinterName プロパティ有効なプリンタ指定されているかどうかを示す値を取得します
パブリック プロパティ LandscapeAngle 向き用紙回転して横向きにする場合角度 (°) を取得します
パブリック プロパティ MaximumCopies プリンタ一度印刷できる最大部数取得します
パブリック プロパティ MaximumPage PrintDialog で選択できる FromPage または ToPage の最大値取得または設定します
パブリック プロパティ MinimumPage PrintDialog選択できる FromPage または ToPage最小値取得または設定します
パブリック プロパティ PaperSizes プリンタサポートされている用紙サイズ取得します
パブリック プロパティ PaperSources プリンタ使用できる用紙トレイ取得します
パブリック プロパティ PrinterName 使用するプリンタの名前を取得または設定します
パブリック プロパティ PrinterResolutions プリンタサポートされている解像度をすべて取得します
パブリック プロパティ PrintFileName ファイル出力する際にファイル名取得または設定します
パブリック プロパティ PrintRange ユーザー指定した印刷ページ番号取得または設定します
パブリック プロパティ PrintToFile ポートではなくファイル印刷出力送信するかどうかを示す値を取得または設定します
パブリック プロパティ SupportsColor プリンタカラー印刷サポートしているかどうかを示す値を取得します
パブリック プロパティ ToPage 印刷終了ページ番号取得または設定します
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Clone この PrinterSettingsコピー作成します
パブリック メソッド CreateMeasurementGraphics オーバーロードされますプリンタ情報格納する Graphics返します
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 (Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 (Object から継承されます。)
パブリック メソッド GetHdevmode オーバーロードされますプリンタ設定対応する DEVMODE 構造体識別するハンドル作成します
パブリック メソッド GetHdevnames プリンタ設定対応する DEVNAMES 構造体識別するハンドル作成します
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド IsDirectPrintingSupported オーバーロードされますイメージ ファイル印刷プリンタサポートしているかどうかを示す値を返します
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド SetHdevmode 特定のハンドルから PrinterSettings関連情報コピーします
パブリック メソッド SetHdevnames 特定のハンドルから PrinterSettings関連情報コピーします
パブリック メソッド ToString オーバーライドされますPrinterSettings に関する情報文字列形式提供します
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

PrinterSettings クラス
System.Drawing.Printing 名前空間
PrinterName
PrintDocument.PrinterSettings プロパティ
PageSettings.PrinterSettings プロパティ



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「PrinterSettings」の関連用語

PrinterSettingsのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



PrinterSettingsのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS