StatusBar.Panels 속성

정의

해당 컨트롤에 포함된 StatusBar 패널의 컬렉션을 가져옵니다.

public:
 property System::Windows::Forms::StatusBar::StatusBarPanelCollection ^ Panels { System::Windows::Forms::StatusBar::StatusBarPanelCollection ^ get(); };
public System.Windows.Forms.StatusBar.StatusBarPanelCollection Panels { get; }
member this.Panels : System.Windows.Forms.StatusBar.StatusBarPanelCollection
Public ReadOnly Property Panels As StatusBar.StatusBarPanelCollection

속성 값

StatusBar.StatusBarPanelCollection 컨트롤의 StatusBarPanel 개체를 포함하는 StatusBar입니다.

예제

다음 코드 예제에서는 폼에 컨트롤을 StatusBar 만들고 두 개의 StatusBarPanel 개체를 추가합니다. 중 하나는 StatusBarPanel 명명 된 개체 panel1, 애플리케이션에 대 한 상태 텍스트를 표시 합니다. 라는 두 번째 StatusBarPanel 개체는 현재 날짜를 표시하고 클래스의 StatusBarPanel 속성을 사용하여 ToolTipText 현재 시간을 표시panel2합니다. 이 예제에서는 속성을 사용하여 ShowPanels 패널이 표준 패널 대신 표시되도록 하고 및 속성을 사용하여 Panels 의 메서드 StatusBar.StatusBarPanelCollection 에 액세스 Add 하여 패널을 에 추가합니다StatusBar. 이 예제에서는 , , ToolTipTextBorderStyleText 속성을 사용하여 AutoSize개체를 StatusBarPanel 초기화합니다. 이 예제에서는 예제에 정의된 메서드가 의 생성자에서 정의되고 호출되어야 합니다 Form.

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.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 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

설명

StatusBar 컨트롤에는 여러 애플리케이션의 사용자에 게 정보를 제공 하는 패널을 표시할 수 있습니다. 예를 들어 패널은 파일 다운로드의 현재 시간 또는 진행률을 표시할 수 있습니다. 컨트롤에 StatusBar 의해 표시되는 각 패널은 클래스의 StatusBarPanel 인스턴스입니다. 속성을 Panels 사용하면 컨트롤에 현재 저장된 개체의 StatusBarPanel 컬렉션에 대한 참조를 StatusBar 가져올 수 있습니다. 이 참조를 사용하여 패널을 추가하고, 패널을 제거하고, 컬렉션 내의 특정 패널에 액세스하고, 컨트롤의 패널 수를 가져올 수 있습니다 StatusBar . 패널 컬렉션을 사용하여 수행할 수 있는 작업에 대한 자세한 내용은 클래스 참조 항목을 참조 StatusBar.StatusBarPanelCollection 하세요.

적용 대상

추가 정보