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

PageSetupDialog イベント


PageSetupDialog クラス

余白や用紙方向など、ページ関連の印刷設定をユーザーが変更できるようにします。このクラスは継承できません。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public NotInheritable Class
 PageSetupDialog
    Inherits CommonDialog
Dim instance As PageSetupDialog
public sealed class PageSetupDialog : CommonDialog
public ref class PageSetupDialog sealed : public
 CommonDialog
public final class PageSetupDialog extends
 CommonDialog
public final class PageSetupDialog extends
 CommonDialog
解説解説
使用例使用例

PageSettings プロパティ、PrinterSettings プロパティ、および ShowNetwork プロパティを使用した PageSetupDialog のコード例を次に示します。この例を実行するには、Button1 という名前の Button、ListBox1 という名前の ListBox、および PageSetupDialog1 という名前の PageSetupDialog が配置されているフォームを使用してください。Button1 の click イベントは、この例のイベント処理メソッドに必ず関連付けるようにしてください。

'This method displays a PageSetupDialog object. If the
' user clicks OK in the dialog, selected results of
' the dialog are displayed in ListBox1.
Private Sub Button1_Click(ByVal
 sender As System.Object, _
    ByVal e As System.EventArgs) Handles
 Button1.Click

    ' Initialize the dialog's PrinterSettings property to hold user
    ' defined printer settings.
    PageSetupDialog1.PageSettings = _
        New System.Drawing.Printing.PageSettings

    ' Initialize dialog's PrinterSettings property to hold user
    ' set printer settings.
    PageSetupDialog1.PrinterSettings = _
        New System.Drawing.Printing.PrinterSettings

    'Do not show the network in the printer dialog.
    PageSetupDialog1.ShowNetwork = False

    'Show the dialog storing the result.
    Dim result As DialogResult = PageSetupDialog1.ShowDialog()

    ' If the result is OK, display selected settings in
    ' ListBox1. These values can be used when printing the
    ' document.
    If (result = DialogResult.OK) Then
        Dim results() As Object
 = New Object() _
            {PageSetupDialog1.PageSettings.Margins, _
             PageSetupDialog1.PageSettings.PaperSize, _
             PageSetupDialog1.PageSettings.Landscape, _
             PageSetupDialog1.PrinterSettings.PrinterName, _
             PageSetupDialog1.PrinterSettings.PrintRange}
        ListBox1.Items.AddRange(results)
    End If
End Sub
//This method displays a PageSetupDialog object. If the
// user clicks OK in the dialog, selected results of
// the dialog are displayed in ListBox1.
private void Button1_Click(System.Object sender,
 System.EventArgs e)
{

    // Initialize the dialog's PrinterSettings property to hold user
    // defined printer settings.
    PageSetupDialog1.PageSettings = 
        new System.Drawing.Printing.PageSettings();

    // Initialize dialog's PrinterSettings property to hold user
    // set printer settings.
    PageSetupDialog1.PrinterSettings = 
        new System.Drawing.Printing.PrinterSettings();

    //Do not show the network in the printer dialog.
    PageSetupDialog1.ShowNetwork = false;

    //Show the dialog storing the result.
    DialogResult result = PageSetupDialog1.ShowDialog();

    // If the result is OK, display selected settings in
    // ListBox1. These values can be used when printing the
    // document.
    if ( result == DialogResult.OK)
    {
        object[] results = new object[]{ 
            PageSetupDialog1.PageSettings.Margins, 
            PageSetupDialog1.PageSettings.PaperSize, 
            PageSetupDialog1.PageSettings.Landscape, 
            PageSetupDialog1.PrinterSettings.PrinterName, 
            PageSetupDialog1.PrinterSettings.PrintRange};
        ListBox1.Items.AddRange(results);
    }
}
//This method displays a PageSetupDialog object. If the
// user clicks OK in the dialog, selected results of
// the dialog are displayed in ListBox1.
void Button1_Click( System::Object^ /*sender*/, System::EventArgs^
 /*e*/ )
{
   
   // Initialize the dialog's PrinterSettings property to hold user
   // defined printer settings.
   PageSetupDialog1->PageSettings = gcnew System::Drawing::Printing::PageSettings;
   
   // Initialize dialog's PrinterSettings property to hold user
   // set printer settings.
   PageSetupDialog1->PrinterSettings = gcnew System::Drawing::Printing::PrinterSettings;
   
   //Do not show the network in the printer dialog.
   PageSetupDialog1->ShowNetwork = false;
   
   //Show the dialog storing the result.
   System::Windows::Forms::DialogResult result = PageSetupDialog1->ShowDialog();
   
   // If the result is OK, display selected settings in
   // ListBox1. These values can be used when printing the
   // document.
   if ( result == ::DialogResult::OK )
   {
      array<Object^>^results = {PageSetupDialog1->PageSettings->Margins
,PageSetupDialog1->PageSettings->PaperSize,PageSetupDialog1->PageSettings->Landscape
,PageSetupDialog1->PrinterSettings->PrinterName,PageSetupDialog1->PrinterSettings->PrintRange};
      ListBox1->Items->AddRange( results );
   }
}
//This method displays a PageSetupDialog object. If the
// user clicks OK in the dialog, selected results of
// the dialog are displayed in ListBox1.
private void button1_Click(System.Object sender,
 System.EventArgs e)
{
    // Initialize the dialog's PrinterSettings property to hold user
    // defined printer settings.
    pageSetupDialog1.set_PageSettings(
        new System.Drawing.Printing.PageSettings());
    // Initialize dialog's PrinterSettings property to hold user
    // set printer settings.
    pageSetupDialog1.set_PrinterSettings(
        new System.Drawing.Printing.PrinterSettings());
    //Do not show the network in the printer dialog.
    pageSetupDialog1.set_ShowNetwork(false);
    //Show the dialog storing the result.
    DialogResult result = pageSetupDialog1.ShowDialog();
    // If the result is OK, display selected settings in
    // ListBox1. These values can be used when printing the
    // document.
    if (result.Equals(get_DialogResult().OK)) {
        Object results[] = new Object[] {
            pageSetupDialog1.get_PageSettings().get_Margins(),
            pageSetupDialog1.get_PageSettings().get_PaperSize(),
            ((System.Boolean)pageSetupDialog1.get_PageSettings().
            get_Landscape()),
            pageSetupDialog1.get_PrinterSettings().get_PrinterName(),
            pageSetupDialog1.get_PrinterSettings().get_PrintRange()};
        listBox1.get_Items().AddRange(results);
    }
} //button1_Click
継承階層継承階層
System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
       System.Windows.Forms.CommonDialog
        System.Windows.Forms.PageSetupDialog
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
PageSetupDialog メンバ
System.Windows.Forms 名前空間
CommonDialog クラス
Margins
PageSettings
PrintDocument
PrinterSettings

PageSetupDialog コンストラクタ

PageSetupDialog クラスの新しいインスタンスを初期化します。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Dim instance As New PageSetupDialog
public PageSetupDialog ()
public:
PageSetupDialog ()
public PageSetupDialog ()
public function PageSetupDialog ()
解説解説

PageSetupDialog のインスタンスが作成されると、次のプロパティが指定した値に初期化されます。

プロパティ

初期値

AllowMargins

true

AllowOrientation

true

AllowPaper

true

AllowPrinter

true

Document

null 参照 (Visual Basic では Nothing)

MinMargins

null 参照 (Visual Basic では Nothing)

PageSettings

null 参照 (Visual Basic では Nothing)

PrinterSettings

null 参照 (Visual Basic では Nothing)

ShowHelp

false

ShowNetwork

true

これらのプロパティの値は、各プロパティを個別に呼び出して変更できます。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
PageSetupDialog クラス
PageSetupDialog メンバ
System.Windows.Forms 名前空間
Margins
PageSettings
PrintDocument
PrinterSettings
CommonDialog クラス

PageSetupDialog プロパティ


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

( プロテクト プロパティ も参照)
  名前 説明
パブリック プロパティ AllowMargins ダイアログ ボックスの余白セクションが有効かどうかを表す値を取得または設定します。
パブリック プロパティ AllowOrientation ダイアログ ボックスの用紙方向セクション (横向きまたは縦向き) が有効かどうかを表す値を取得または設定します。
パブリック プロパティ AllowPaper ダイアログ ボックスの用紙セクション (用紙サイズと給紙方法) が有効かどうかを表す値を取得または設定します。
パブリック プロパティ AllowPrinter [印刷] ボタンが有効かどうかを示す値を取得または設定します。
パブリック プロパティ Container  Component を格納している IContainer を取得します。 ( Component から継承されます。)
パブリック プロパティ Document ページ設定を取得する対象の PrintDocument を示す値を取得または設定します。
パブリック プロパティ EnableMetric 余白設定をミリメートル単位で表示する場合、自動的に 1/100 インチ単位からミリメートル単位に、またはその逆に変換するかどうかを表す値を取得または設定します。
パブリック プロパティ MinMargins ユーザーが選択できる余白の最小値 (1/100 インチ単位) を取得または設定します。
パブリック プロパティ PageSettings 変更する対象のページ設定を示す値を取得または設定します。
パブリック プロパティ PrinterSettings ダイアログ ボックスの [プリンタ] ボタンがクリックされた場合に変更するプリンタ設定を取得または設定します。
パブリック プロパティ ShowHelp [ヘルプ] ボタンを表示するかどうかを示す値を取得または設定します。
パブリック プロパティ ShowNetwork [ネットワーク] ボタンを表示するかどうかを示す値を取得または設定します。
パブリック プロパティ Site  Component の ISite を取得または設定します。 ( Component から継承されます。)
パブリック プロパティ Tag  コントロールに関するデータを格納するオブジェクトを取得または設定します。 ( CommonDialog から継承されます。)
プロテクト プロパティプロテクト プロパティ
参照参照

関連項目

PageSetupDialog クラス
System.Windows.Forms 名前空間
CommonDialog クラス
Margins
PageSettings
PrintDocument
PrinterSettings

PageSetupDialog メソッド


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

( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド CreateObjRef  リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド Dispose  オーバーロードされます。 Component によって使用されているリソースを解放します。 ( Component から継承されます。)
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。)
パブリック メソッド GetLifetimeService  対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド InitializeLifetimeService  対象のインスタンスの有効期間ポリシーを制御する、有効期間サービス オブジェクトを取得します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド Reset オーバーライドされます。 すべてのオプションを既定値にリセットします。
パブリック メソッド ShowDialog  オーバーロードされます。 コモン ダイアログ ボックスを実行します。 ( CommonDialog から継承されます。)
パブリック メソッド ToString  Component の名前を格納している String を返します (存在する場合)。このメソッドはオーバーライドできません。 ( Component から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

PageSetupDialog クラス
System.Windows.Forms 名前空間
CommonDialog クラス
Margins
PageSettings
PrintDocument
PrinterSettings

PageSetupDialog メンバ

余白や用紙方向など、ページ関連の印刷設定をユーザーが変更できるようにします。このクラスは継承できません。

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


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド PageSetupDialog PageSetupDialog クラスの新しいインスタンスを初期化します。
パブリック プロパティパブリック プロパティ
( プロテクト プロパティ も参照)
  名前 説明
パブリック プロパティ AllowMargins ダイアログ ボックスの余白セクションが有効かどうかを表す値を取得または設定します。
パブリック プロパティ AllowOrientation ダイアログ ボックスの用紙方向セクション (横向きまたは縦向き) が有効かどうかを表す値を取得または設定します。
パブリック プロパティ AllowPaper ダイアログ ボックスの用紙セクション (用紙サイズと給紙方法) が有効かどうかを表す値を取得または設定します。
パブリック プロパティ AllowPrinter [印刷] ボタンが有効かどうかを示す値を取得または設定します。
パブリック プロパティ Container  Component を格納している IContainer を取得します。(Component から継承されます。)
パブリック プロパティ Document ページ設定を取得する対象の PrintDocument を示す値を取得または設定します。
パブリック プロパティ EnableMetric 余白設定をミリメートル単位で表示する場合、自動的に 1/100 インチ単位からミリメートル単位に、またはその逆に変換するかどうかを表す値を取得または設定します。
パブリック プロパティ MinMargins ユーザーが選択できる余白の最小値 (1/100 インチ単位) を取得または設定します。
パブリック プロパティ PageSettings 変更する対象のページ設定を示す値を取得または設定します。
パブリック プロパティ PrinterSettings ダイアログ ボックスの [プリンタ] ボタンがクリックされた場合に変更するプリンタ設定を取得または設定します。
パブリック プロパティ ShowHelp [ヘルプ] ボタンを表示するかどうかを示す値を取得または設定します。
パブリック プロパティ ShowNetwork [ネットワーク] ボタンを表示するかどうかを示す値を取得または設定します。
パブリック プロパティ Site  Component の ISite を取得または設定します。(Component から継承されます。)
パブリック プロパティ Tag  コントロールに関するデータを格納するオブジェクトを取得または設定します。 (CommonDialog から継承されます。)
プロテクト プロパティプロテクト プロパティ
パブリック メソッドパブリック メソッド
( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド CreateObjRef  リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。 (MarshalByRefObject から継承されます。)
パブリック メソッド Dispose  オーバーロードされます。 Component によって使用されているリソースを解放します。 (Component から継承されます。)
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。)
パブリック メソッド GetLifetimeService  対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。 (MarshalByRefObject から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド InitializeLifetimeService  対象のインスタンスの有効期間ポリシーを制御する、有効期間サービス オブジェクトを取得します。 (MarshalByRefObject から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド Reset オーバーライドされます。 すべてのオプションを既定値にリセットします。
パブリック メソッド ShowDialog  オーバーロードされます。 コモン ダイアログ ボックスを実行します。 (CommonDialog から継承されます。)
パブリック メソッド ToString  Component の名前を格納している String を返します (存在する場合)。このメソッドはオーバーライドできません。 (Component から継承されます。)
プロテクト メソッドプロテクト メソッド
パブリック イベントパブリック イベント
参照参照

関連項目

PageSetupDialog クラス
System.Windows.Forms 名前空間
CommonDialog クラス
Margins
PageSettings
PrintDocument
PrinterSettings



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「PageSetupDialog」の関連用語

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

   

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



PageSetupDialogのページの著作権

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

©2026 GRAS Group, Inc.RSS