StatusBar.StatusBarPanelCollection クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > StatusBar.StatusBarPanelCollection クラスの意味・解説 

StatusBar.StatusBarPanelCollection クラス

StatusBar コントロール内のパネルコレクション表します

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

Public Class StatusBarPanelCollection
    Implements IList, ICollection, IEnumerable
Dim instance As StatusBarPanelCollection
public class StatusBarPanelCollection : IList,
 ICollection, IEnumerable
public ref class StatusBarPanelCollection :
 IList, ICollection, IEnumerable
public class StatusBarPanelCollection implements
 IList, ICollection, 
    IEnumerable
public class StatusBarPanelCollection implements
 IList, ICollection, 
    IEnumerable
解説解説

StatusBar.StatusBarPanelCollection クラスは、StatusBar表示されるパネル格納します。このコレクション内のオブジェクトは、StatusBar 内に表示されるパネル表示特性表示動作定義する、StatusBarPanel クラスインスタンスです。

パネルコレクション追加するには、いくつか方法ありますAdd メソッド使用すると、単一パネルコレクション追加できます複数パネルコレクション追加するには、StatusBarPanel オブジェクト配列作成し、その配列を AddRange メソッド割り当てますコレクション内の特定の位置パネル挿入するには、Insert メソッド使用しますパネル削除するには、Remove メソッドか、コレクション内のパネル位置判明している場合は RemoveAt メソッド使用できます一度1 つパネルしか削除できない Remove メソッド使用する代わりにClear メソッド使用すると、コレクションからすべてのパネル削除できます

パネル追加および削除するメソッドプロパティのほかに、StatusBar.StatusBarPanelCollection は、コレクション内でパネル検索するメソッド提供します。Contains メソッド使用すると、パネルコレクションメンバであるかどうか確認できますコレクション内にパネルがあることがわかれば、IndexOf メソッド使用して、そのパネルコレクションのどこにあるかを判断できます

使用例使用例

フォームStatusBar コントロール作成し2 つStatusBarPanel オブジェクト追加するコード例次に示しますStatusBarPanel1 つである panel1 は、アプリケーションステータス テキスト表示しますpanel2 という名前のもう一方StatusBarPanel は、現在の日付表示しStatusBarPanel クラスの ToolTipText プロパティ使用して現在の時刻表示します。この例では、標準パネル代わりにこれらのパネル表示されるようにするために ShowPanels プロパティ使用し、さらに Panels プロパティ使用して StatusBar.StatusBarPanelCollectionAdd メソッドアクセスして StatusBarパネル追加しますまた、StatusBarPanel オブジェクト初期化するために、AutoSize、BorderStyle、ToolTipTextText の各プロパティ使用します。この例は、コード内で定義されメソッド定義されており、Formコンストラクタから呼び出されることを前提にしています。

Private Sub CreateMyStatusBar()
   ' Create a StatusBar control.
   Dim statusBar1 As New
 StatusBar()

   ' Create two StatusBarPanel objects to display in the StatusBar.
   Dim panel1 As New StatusBarPanel()
   Dim panel2 As New StatusBarPanel()

   ' Display the first panel with a sunken border style.
   panel1.BorderStyle = StatusBarPanelBorderStyle.Sunken

   ' Initialize the text of the panel.
   panel1.Text = "Ready..."

   ' Set the AutoSize property to use all remaining space on the StatusBar.
   panel1.AutoSize = StatusBarPanelAutoSize.Spring
   
   ' Display the second panel with a raised border style.
   panel2.BorderStyle = StatusBarPanelBorderStyle.Raised
   
   ' Create ToolTip text that displays the time the application was
 started.
   panel2.ToolTipText = "Started: " & System.DateTime.Now.ToShortTimeString()

   ' Set the text of the panel to the current date.
   panel2.Text = System.DateTime.Today.ToLongDateString()

   ' Set the AutoSize property to size the panel to the size of the
 contents.
   panel2.AutoSize = StatusBarPanelAutoSize.Contents

   ' Display panels in the StatusBar control.
   statusBar1.ShowPanels = True

   ' Add both panels to the StatusBarPanelCollection of the StatusBar.
            
   statusBar1.Panels.Add(panel1)
   statusBar1.Panels.Add(panel2)

   ' Add the StatusBar to the form.
   Me.Controls.Add(statusBar1)
End Sub
private void CreateMyStatusBar()
{
    // Create a StatusBar control.
    StatusBar statusBar1 = new StatusBar();
    // Create two StatusBarPanel objects to display in the StatusBar.
    StatusBarPanel panel1 = new StatusBarPanel();
    StatusBarPanel panel2 = new StatusBarPanel();

    // Display the first panel with a sunken border style.
    panel1.BorderStyle = StatusBarPanelBorderStyle.Sunken;
    // Initialize the text of the panel.
    panel1.Text = "Ready...";
    // Set the AutoSize property to use all remaining space on the StatusBar.
    panel1.AutoSize = StatusBarPanelAutoSize.Spring;
    
    // Display the second panel with a raised border style.
    panel2.BorderStyle = StatusBarPanelBorderStyle.Raised;
    
    // Create ToolTip text that displays time the application was 
          //started.
    panel2.ToolTipText = "Started: " + System.DateTime.Now.ToShortTimeString();
    // Set the text of the panel to the current date.
    panel2.Text = System.DateTime.Today.ToLongDateString();
    // Set the AutoSize property to size the panel to the size of the
 contents.
    panel2.AutoSize = StatusBarPanelAutoSize.Contents;
                
    // Display panels in the StatusBar control.
    statusBar1.ShowPanels = true;

    // Add both panels to the StatusBarPanelCollection of the StatusBar.
            
    statusBar1.Panels.Add(panel1);
    statusBar1.Panels.Add(panel2);

    // Add the StatusBar to the form.
    this.Controls.Add(statusBar1);
}
private:
   void CreateMyStatusBar()
   {
      // Create a StatusBar control.
      StatusBar^ statusBar1 = gcnew StatusBar;

      // Create two StatusBarPanel objects to display in the StatusBar.
      StatusBarPanel^ panel1 = gcnew StatusBarPanel;
      StatusBarPanel^ panel2 = gcnew StatusBarPanel;

      // Display the first panel with a sunken border style.
      panel1->BorderStyle = StatusBarPanelBorderStyle::Sunken;

      // Initialize the text of the panel.
      panel1->Text = "Ready...";

      // Set the AutoSize property to use all remaining space on the
 StatusBar.
      panel1->AutoSize = StatusBarPanelAutoSize::Spring;

      // Display the second panel with a raised border style.
      panel2->BorderStyle = StatusBarPanelBorderStyle::Raised;

      // Create ToolTip text that displays the time the application
      // was started.
      panel2->ToolTipText = System::DateTime::Now.ToShortTimeString();

      // Set the text of the panel to the current date.
      panel2->Text = "Started: " + System::DateTime::Today.ToLongDateString();

      // Set the AutoSize property to size the panel to the size of the
 contents.
      panel2->AutoSize = StatusBarPanelAutoSize::Contents;

      // Display panels in the StatusBar control.
      statusBar1->ShowPanels = true;

      // Add both panels to the StatusBarPanelCollection of the StatusBar.
   
      statusBar1->Panels->Add( panel1 );
      statusBar1->Panels->Add( panel2 );

      // Add the StatusBar to the form.
      this->Controls->Add( statusBar1 );
   }
private void CreateMyStatusBar()
{
    // Create a StatusBar control.
    StatusBar statusBar1 = new StatusBar();

    // Create two StatusBarPanel objects to display in the StatusBar.
    StatusBarPanel panel1 = new StatusBarPanel();
    StatusBarPanel panel2 = new StatusBarPanel();

    // Display the first panel with a sunken border style.
    panel1.set_BorderStyle(StatusBarPanelBorderStyle.Sunken);

    // Initialize the text of the panel.
    panel1.set_Text("Ready...");

    // Set the AutoSize property to use all remaining space on the StatusBar.
    panel1.set_AutoSize(StatusBarPanelAutoSize.Spring);

    // Display the second panel with a raised border style.
    panel2.set_BorderStyle(StatusBarPanelBorderStyle.Raised);

    // Create ToolTip text that displays the time the application was
 started.
    panel2.set_ToolTipText("Started: " + System.DateTime.get_Now().ToShortTimeString());
    
// Set the text of the panel to the current date.
    panel2.set_Text(System.DateTime.get_Today().ToLongDateString());
    
// Set the AutoSize property to size the panel to the size of the 
    // contents.
    panel2.set_AutoSize(StatusBarPanelAutoSize.Contents);
    // Display panels in the StatusBar control.
    statusBar1.set_ShowPanels(true);
    // Add both panels to the StatusBarPanelCollection of the StatusBar.
    
    statusBar1.get_Panels().Add(panel1);
    statusBar1.get_Panels().Add(panel2);
    // Add the StatusBar to the form.
    this.get_Controls().Add(statusBar1);
} //CreateMyStatusBar
継承階層継承階層
System.Object
  System.Windows.Forms.StatusBar.StatusBarPanelCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
StatusBar.StatusBarPanelCollection メンバ
System.Windows.Forms 名前空間
StatusBarPanel



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

辞書ショートカット

すべての辞書の索引

「StatusBar.StatusBarPanelCollection クラス」の関連用語

StatusBar.StatusBarPanelCollection クラスのお隣キーワード
検索ランキング

   

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



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

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

©2025 GRAS Group, Inc.RSS