QueryPageSettingsEventArgs クラス
アセンブリ: System.Drawing (system.drawing.dll 内)


ドキュメントの各ページを異なるページ設定を使用して印刷できます。PageSettings のプロパティを個別に変更するか、プロパティを PageSettings に設定することによって、ページ設定を指定します。Cancel プロパティを true に設定することによって、印刷ジョブをキャンセルすることもできます。

文書を印刷するコード例を次に示します。カラー プリンタの場合は、先頭ページがカラーで印刷されます。この例では、printDoc という名前の PrintDocument 変数が既に作成されており、PrintPage イベントと QueryPageSettings イベントが処理されることを前提にしています。
この例では、System.Drawing 名前空間と System.Drawing.Printing 名前空間を使用します。
Private Sub MyButtonPrint_OnClick(ByVal sender As Object, ByVal e As System.EventArgs) ' Set the printer name and ensure it is valid. If not, provide a message to the user. printDoc.PrinterSettings.PrinterName = "\\mynetworkprinter" If printDoc.PrinterSettings.IsValid Then ' If the printer supports printing in color, then override the printer's default behavior. if printDoc.PrinterSettings.SupportsColor then ' Set the page default's to not print in color. printDoc.DefaultPageSettings.Color = False End If ' Provide a friendly name, set the page number, and print the document. printDoc.DocumentName = "My Presentation" currentPageNumber = 1 printDoc.Print() Else MessageBox.Show("Printer is not valid") End If End Sub Private Sub MyPrintQueryPageSettingsEvent(ByVal sender As Object, ByVal e As QueryPageSettingsEventArgs) ' Determines if the printer supports printing in color. If printDoc.PrinterSettings.SupportsColor Then ' If the printer supports color printing, use color. If currentPageNumber = 1 Then e.PageSettings.Color = True End If End If End Sub
private void MyButtonPrint_OnClick(object sender, System.EventArgs e) { // Set the printer name and ensure it is valid. If not, provide a message to the user. printDoc.PrinterSettings.PrinterName = "\\mynetworkprinter"; if (printDoc.PrinterSettings.IsValid) { // If the printer supports printing in color, then override the printer's default behavior. if (printDoc.PrinterSettings.SupportsColor) { // Set the page default's to not print in color. printDoc.DefaultPageSettings.Color = false; } // Provide a friendly name, set the page number, and print the document. printDoc.DocumentName = "My Presentation"; currentPageNumber = 1; printDoc.Print(); } else { MessageBox.Show("Printer is not valid"); } } private void MyPrintQueryPageSettingsEvent(object sender, QueryPageSettingsEventArgs e) { // Determines if the printer supports printing in color. if (printDoc.PrinterSettings.SupportsColor) { // If the printer supports color printing, use color. if (currentPageNumber == 1 ) { e.PageSettings.Color = true; } } }
private: void MyButtonPrint_OnClick( Object^ sender, System::EventArgs^ e ) { // Set the printer name and ensure it is valid. If not, provide a message to the user. printDoc->PrinterSettings->PrinterName = "\\mynetworkprinter"; if ( printDoc->PrinterSettings->IsValid ) { // If the printer supports printing in color, then override the printer's default behavior. if ( printDoc->PrinterSettings->SupportsColor ) { // Set the page default's to not print in color. printDoc->DefaultPageSettings->Color = false; } // Provide a friendly name, set the page number, and print the document. printDoc->DocumentName = "My Presentation"; currentPageNumber = 1; printDoc->Print(); } else { MessageBox::Show( "Printer is not valid" ); } } void MyPrintQueryPageSettingsEvent( Object^ sender, QueryPageSettingsEventArgs^ e ) { // Determines if the printer supports printing in color. if ( printDoc->PrinterSettings->SupportsColor ) { // If the printer supports color printing, use color. if ( currentPageNumber == 1 ) { e->PageSettings->Color = true; } } }
private void myButtonPrint_OnClick(Object sender, System.EventArgs e) { // Set the printer name and ensure it is valid. If not, // provide a message to the user. printDoc.get_PrinterSettings().set_PrinterName("\\mynetworkprinter"); if (printDoc.get_PrinterSettings().get_IsValid()) { // If the printer supports printing in color, then // override the printer's default behavior. if (printDoc.get_PrinterSettings().get_SupportsColor()) { // Set the page default's to not print in color. printDoc.get_DefaultPageSettings().set_Color(false); } // Provide a friendly name, set the page number, and print // the document. printDoc.set_DocumentName("My Presentation"); currentPageNumber = 1; printDoc.Print(); } else { MessageBox.Show("Printer is not valid"); } } //myButtonPrint_OnClick private void MyPrintQueryPageSettingsEvent(Object sender, QueryPageSettingsEventArgs e) { // Determines if the printer supports printing in color. if (printDoc.get_PrinterSettings().get_SupportsColor()) { // If the printer supports color printing, use color. if (currentPageNumber == 1) { e.get_PageSettings().set_Color(true); } } } //MyPrintQueryPageSettingsEvent

System.EventArgs
System.ComponentModel.CancelEventArgs
System.Drawing.Printing.PrintEventArgs
System.Drawing.Printing.QueryPageSettingsEventArgs


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


QueryPageSettingsEventArgs コンストラクタ
アセンブリ: System.Drawing (system.drawing.dll 内)

Public Sub New ( _ pageSettings As PageSettings _ )
Dim pageSettings As PageSettings Dim instance As New QueryPageSettingsEventArgs(pageSettings)
public QueryPageSettingsEventArgs ( PageSettings pageSettings )
public: QueryPageSettingsEventArgs ( PageSettings^ pageSettings )
public QueryPageSettingsEventArgs ( PageSettings pageSettings )
public function QueryPageSettingsEventArgs ( pageSettings : PageSettings )

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


QueryPageSettingsEventArgs プロパティ

名前 | 説明 | |
---|---|---|
![]() | Cancel | イベントをキャンセルするかどうかを示す値を取得または設定します。 ( CancelEventArgs から継承されます。) |
![]() | PageSettings | 印刷するページのページ設定を取得または設定します。 |
![]() | PrintAction | 発生している印刷操作の種類を示す値を取得します。 ( PrintEventArgs から継承されます。) |

QueryPageSettingsEventArgs メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

QueryPageSettingsEventArgs メンバ
QueryPageSettings イベントのデータを提供します。
QueryPageSettingsEventArgs データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | Cancel | イベントをキャンセルするかどうかを示す値を取得または設定します。(CancelEventArgs から継承されます。) |
![]() | PageSettings | 印刷するページのページ設定を取得または設定します。 |
![]() | PrintAction | 発生している印刷操作の種類を示す値を取得します。(PrintEventArgs から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- QueryPageSettingsEventArgsのページへのリンク