PrintDocument.DefaultPageSettings プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > PrintDocument.DefaultPageSettings プロパティの意味・解説 

PrintDocument.DefaultPageSettings プロパティ

印刷するすべてのページ既定値として使用されるページ設定取得または設定します

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

Dim instance As PrintDocument
Dim value As PageSettings

value = instance.DefaultPageSettings

instance.DefaultPageSettings = value
public PageSettings DefaultPageSettings { get;
 set; }
/** @property */
public PageSettings get_DefaultPageSettings ()

/** @property */
public void set_DefaultPageSettings (PageSettings
 value)
public function get DefaultPageSettings
 () : PageSettings

public function set DefaultPageSettings
 (value : PageSettings)

プロパティ
ドキュメント既定ページ設定指定する PageSettings

解説解説

DefaultPageSettings プロパティ使用して複数既定ページ設定指定できます。たとえば、PageSettings.Color プロパティは、ページカラー印刷するかどうか指定します。PageSettings.Landscape プロパティは、横向きまたは縦向き用紙方向指定します。PageSettings.Margins プロパティは、ページ余白指定します

ページごとに設定指定するには、PrintPage イベントまたは QueryPageSettings イベント処理しそれぞれ PrintPageEventArgs または QueryPageSettingsEventArgs に含まれる PageSettings 引数変更します

メモメモ

印刷開始後に DefaultPageSettings プロパティ使用してページ設定変更しても、印刷中のページには影響与えません。

使用例使用例

ドキュメント用紙方向横向き設定しドキュメント印刷するコード例次に示します。この例は、次の 3 つのことを前提にしています。変数 filePath印刷するファイルパス設定されていること、PrintPage イベント処理するメソッド pd_PrintPage定義されていること、変数 printerプリンタ名に設定されていることです。

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

Public Sub Printing()
    Try
        streamToPrint = New StreamReader(filePath)
        Try
            printFont = New Font("Arial",
 10)
            Dim pd As New
 PrintDocument()
            AddHandler pd.PrintPage, AddressOf
 pd_PrintPage
            pd.PrinterSettings.PrinterName = printer
            ' Set the page orientation to landscape.
            pd.DefaultPageSettings.Landscape = True
            pd.Print()
        Finally
            streamToPrint.Close()
        End Try
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try
End Sub    
   
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);
   }
}

public:
   void Printing()
   {
      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 );
            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 );
      }
   }
public void Printing()
{
    try {
        streamToPrint = new StreamReader(filePath);
        try {
            printFont = new Font("Arial", 10);
            PrintDocument pd = new PrintDocument();
            pd.add_PrintPage(new PrintPageEventHandler(pd_PrintPage));
            pd.get_PrinterSettings().set_PrinterName(printer);

            // Set the page orientation to landscape.
            pd.get_DefaultPageSettings().set_Landscape(true);
            pd.Print();
        }
        finally {
            streamToPrint.Close();
        }
    }
    catch (System.Exception ex) {
        MessageBox.Show(ex.get_Message());
    }
} //Printing
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
PrintDocument クラス
PrintDocument メンバ
System.Drawing.Printing 名前空間
PageSettings クラス
PrintController
PrinterSettings


このページでは「.NET Framework クラス ライブラリ リファレンス」からPrintDocument.DefaultPageSettings プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からPrintDocument.DefaultPageSettings プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からPrintDocument.DefaultPageSettings プロパティ を検索

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

辞書ショートカット

すべての辞書の索引

「PrintDocument.DefaultPageSettings プロパティ」の関連用語

PrintDocument.DefaultPageSettings プロパティのお隣キーワード
検索ランキング

   

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



PrintDocument.DefaultPageSettings プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS