편집

다음을 통해 공유


StatusBar.Text Property

Definition

Gets or sets the text associated with the StatusBar control.

public:
 virtual property System::String ^ Text { System::String ^ get(); void set(System::String ^ value); };
public override string Text { get; set; }
member this.Text : string with get, set
Public Overrides Property Text As String

Property Value

The text associated with the StatusBar control.

Examples

The following code example demonstrates how to use the Text property. To run the example, paste the following code in a form. Call the InitializeSimpleStatusBar method in the form's constructor or Load method.

   // Initialize a single-panel status bar.  This is done
   // by setting the Text property and setting ShowPanels to False.
private:
   void InitializeSimpleStatusBar()
   {
      
      // Declare the StatusBar control
      StatusBar^ simpleStatusBar = gcnew StatusBar;
      
      // Set the ShowPanels property to False.
      simpleStatusBar->ShowPanels = false;
      
      // Set the text.
      simpleStatusBar->Text = "This is a single-panel status bar";
      
      // Set the width and anchor the StatusBar
      simpleStatusBar->Width = 200;
      simpleStatusBar->Anchor = AnchorStyles::Top;
      
      // Add the StatusBar to the form.
      this->Controls->Add( simpleStatusBar );
   }
// Initialize a single-panel status bar.  This is done
// by setting the Text property and setting ShowPanels to False.

private void InitializeSimpleStatusBar()
{

    // Declare the StatusBar control
    StatusBar simpleStatusBar = new StatusBar();

    // Set the ShowPanels property to False.
    simpleStatusBar.ShowPanels = false;

    // Set the text.
    simpleStatusBar.Text = "This is a single-panel status bar";

    // Set the width and anchor the StatusBar
    simpleStatusBar.Width = 200;
    simpleStatusBar.Anchor = AnchorStyles.Top;

    // Add the StatusBar to the form.
    this.Controls.Add(simpleStatusBar);
}
' Initialize a single-panel status bar.  This is done
' by setting the Text property and setting ShowPanels to False.
Private Sub InitializeSimpleStatusBar()

    ' Declare the StatusBar control
    Dim simpleStatusBar As New StatusBar

    ' Set the ShowPanels property to False.
    simpleStatusBar.ShowPanels = False

    ' Set the text.
    simpleStatusBar.Text = "This is a single-panel status bar"

    ' Set the width and anchor the StatusBar
    simpleStatusBar.Width = 200
    simpleStatusBar.Anchor = AnchorStyles.Top

    ' Add the StatusBar to the form.
    Me.Controls.Add(simpleStatusBar)

End Sub

Remarks

This property represents the text displayed by the control.

Caution

The StatusBar control displays only the first 127 characters of a string.

Applies to