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

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

PrinterSettings.InstalledPrinters プロパティ

コンピュータインストールされているすべてのプリンタの名前を取得します

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

Public Shared ReadOnly Property
 InstalledPrinters As StringCollection
Dim value As StringCollection

value = PrinterSettings.InstalledPrinters
public static StringCollection InstalledPrinters
 { get; }
public:
static property StringCollection^ InstalledPrinters {
    StringCollection^ get ();
}
/** @property */
public static StringCollection get_InstalledPrinters
 ()
public static function get
 InstalledPrinters () : StringCollection

プロパティ
コンピュータインストールされているすべてのプリンタの名前を表す PrinterSettings.StringCollection。

例外例外
解説解説
使用例使用例

インストールされているプリンタcomboInstalledPrinters コンボ ボックス表示し選択内容変更されたときに、PrinterName プロパティ使用して印刷を行うプリンタ設定するコード例次に示しますフォーム初期化されると、PopulateInstalledPrintersCombo ルーチン呼び出されます。この例では、printDoc という名前の PrintDocument 変数と、特定のコンボ ボックス存在することが必要です。

Private Sub PopulateInstalledPrintersCombo()
    ' Add list of installed printers found to the combo box.
    ' The pkInstalledPrinters string will be used to provide the display
 string.
    Dim i as Integer
    Dim pkInstalledPrinters As String

    For i = 0 to PrinterSettings.InstalledPrinters.Count
 - 1
        pkInstalledPrinters = PrinterSettings.InstalledPrinters.Item(i)
        comboInstalledPrinters.Items.Add(pkInstalledPrinters)
    Next
End Sub

Private Sub comboInstalledPrinters_SelectionChanged(ByVal
 sender As System.Object, ByVal e As
 System.EventArgs) Handles comboInstalledPrinters.SelectedIndexChanged
    ' Set the printer to a printer in the combo box when the selection
 changes.

    If comboInstalledPrinters.SelectedIndex <> -1 Then
        ' The combo box's Text property returns the selected item's
 text, which is the printer name.
        printDoc.PrinterSettings.PrinterName = comboInstalledPrinters.Text
    End If


End Sub
private void PopulateInstalledPrintersCombo()
{
    // Add list of installed printers found to the combo box.
    // The pkInstalledPrinters string will be used to provide the display
 string.
    String pkInstalledPrinters;
    for (int i = 0; i < PrinterSettings.InstalledPrinters.Count;
 i++){
        pkInstalledPrinters = PrinterSettings.InstalledPrinters[i];
        comboInstalledPrinters.Items.Add(pkInstalledPrinters);
    }
}

private void comboInstalledPrinters_SelectionChanged(object
 sender, System.EventArgs e)
{

    // Set the printer to a printer in the combo box when the selection
 changes.

    if (comboInstalledPrinters.SelectedIndex != -1) 
    {
        // The combo box's Text property returns the selected item's
 text, which is the printer name.
        printDoc.PrinterSettings.PrinterName= comboInstalledPrinters.Text;
    }

}
private:
   void PopulateInstalledPrintersCombo()
   {
      // Add list of installed printers found to the combo box.
      // The pkInstalledPrinters String will be used to provide the
 display String.
      String^ pkInstalledPrinters;
      for ( int i = 0; i < PrinterSettings::InstalledPrinters->Count;
 i++ )
      {
         pkInstalledPrinters = PrinterSettings::InstalledPrinters[ i ];
         comboInstalledPrinters->Items->Add( pkInstalledPrinters );
      }
   }

   void comboInstalledPrinters_SelectionChanged( Object^ sender,
 System::EventArgs^ e )
   {
      // Set the printer to a printer in the combo box when the selection
 changes.
      if ( comboInstalledPrinters->SelectedIndex != -1 )
      {
         // The combo box's Text property returns the selected item's
 text, which is the printer name.
         printDoc->PrinterSettings->PrinterName = comboInstalledPrinters->Text;
      }
   }
private void PopulateInstalledPrintersCombo()
{
    // Add list of installed printers found to the combo box.
    // The pkInstalledPrinters string will be used to provide the 
    // display string.
    String pkInstalledPrinters;
    for (int i = 0; i < PrinterSettings.get_InstalledPrinters().
        get_Count(); i++) {
        pkInstalledPrinters = PrinterSettings.get_InstalledPrinters().
            get_Item(i);
        comboInstalledPrinters.get_Items().Add(pkInstalledPrinters);
    }
} //PopulateInstalledPrintersCombo

private void comboInstalledPrinters_SelectionChanged(Object
 sender, 
    System.EventArgs e)
{
    // Set the printer to a printer in the combo box when the 
    // selection changes.
    if (comboInstalledPrinters.get_SelectedIndex() != -1) {
        // The combo box's Text property returns the selected item's
        // text, which is the printer name.
        printDoc.get_PrinterSettings().
            set_PrinterName(comboInstalledPrinters.get_Text());
    }
} //comboInstalledPrinters_SelectionChanged
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
PrinterSettings クラス
PrinterSettings メンバ
System.Drawing.Printing 名前空間
PrinterName


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

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

辞書ショートカット

すべての辞書の索引

「PrinterSettings.InstalledPrinters プロパティ」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS