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

QueryPageSettingsEventArgs クラス

QueryPageSettings イベントデータ提供します

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

Public Class QueryPageSettingsEventArgs
    Inherits PrintEventArgs
Dim instance As QueryPageSettingsEventArgs
public class QueryPageSettingsEventArgs : PrintEventArgs
public ref class QueryPageSettingsEventArgs
 : public PrintEventArgs
public class QueryPageSettingsEventArgs extends
 PrintEventArgs
public class QueryPageSettingsEventArgs extends
 PrintEventArgs
解説解説
使用例使用例

文書印刷するコード例次に示しますカラー プリンタ場合は、先頭ページカラー印刷されます。この例では、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.Object
   System.EventArgs
     System.ComponentModel.CancelEventArgs
       System.Drawing.Printing.PrintEventArgs
        System.Drawing.Printing.QueryPageSettingsEventArgs
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
QueryPageSettingsEventArgs メンバ
System.Drawing.Printing 名前空間
PrintDocument クラス
OnQueryPageSettings
PrintDocument.QueryPageSettings イベント
QueryPageSettingsEventHandler

QueryPageSettingsEventArgs コンストラクタ


QueryPageSettingsEventArgs プロパティ


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

  名前 説明
パブリック プロパティ Cancel  イベントキャンセルするかどうかを示す値を取得または設定します。 ( CancelEventArgs から継承されます。)
パブリック プロパティ PageSettings 印刷するページページ設定取得または設定します
パブリック プロパティ PrintAction  発生している印刷操作種類を示す値を取得します。 ( PrintEventArgs から継承されます。)
参照参照

関連項目

QueryPageSettingsEventArgs クラス
System.Drawing.Printing 名前空間
PrintDocument クラス
OnQueryPageSettings
PrintDocument.QueryPageSettings イベント
QueryPageSettingsEventHandler

QueryPageSettingsEventArgs メソッド


QueryPageSettingsEventArgs メンバ

QueryPageSettings イベントデータ提供します

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


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド QueryPageSettingsEventArgs QueryPageSettingsEventArgs クラス新しインスタンス初期化します。
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

QueryPageSettingsEventArgs クラス
System.Drawing.Printing 名前空間
PrintDocument クラス
OnQueryPageSettings
PrintDocument.QueryPageSettings イベント
QueryPageSettingsEventHandler



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

辞書ショートカット

すべての辞書の索引

「QueryPageSettingsEventArgs」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS