Freigeben über


StatusBar.Text-Eigenschaft

Ruft den dem StatusBar-Steuerelement zugeordneten Text ab oder legt diesen fest.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
<LocalizableAttribute(True)> _
Public Overrides Property Text As String
'Usage
Dim instance As StatusBar
Dim value As String

value = instance.Text

instance.Text = value
[LocalizableAttribute(true)] 
public override string Text { get; set; }
[LocalizableAttribute(true)] 
public:
virtual property String^ Text {
    String^ get () override;
    void set (String^ value) override;
}
/** @property */
public String get_Text ()

/** @property */
public void set_Text (String value)
public override function get Text () : String

public override function set Text (value : String)

Eigenschaftenwert

Der dem StatusBar-Steuerelement zugeordnete Text.

Hinweise

Diese Eigenschaft stellt den vom Steuerelement angezeigten Text dar.

Warnung

Im StatusBar-Steuerelement werden nur die ersten 127 Zeichen einer Zeichenfolge angezeigt.

Beispiel

Im folgenden Codebeispiel wird die Verwendung der Text-Eigenschaft veranschaulicht. Fügen Sie zum Ausführen des Beispiels den folgenden Code in ein Formular ein. Rufen Sie die InitializeSimpleStatusBar-Methode im Konstruktor oder in der Load-Methode des Formulars auf.

' 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
// 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:
   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.set_ShowPanels(false);
    // Set the text.
    simpleStatusBar.set_Text("This is a single-panel status bar");
    // Set the width and anchor the StatusBar
    simpleStatusBar.set_Width(200);
    simpleStatusBar.set_Anchor(AnchorStyles.Top);
    // Add the StatusBar to the form.
    this.get_Controls().Add(simpleStatusBar);
} //InitializeSimpleStatusBar 

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

StatusBar-Klasse
StatusBar-Member
System.Windows.Forms-Namespace