StatusBar.Text 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定與 StatusBar 控制項相關的文字。
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
屬性值
與 StatusBar 控制項相關聯的文字。
範例
下列程式碼範例示範如何使用 Text 屬性。 若要執行範例,請將下列程式碼貼到表單中。 InitializeSimpleStatusBar
在表單的建構函式或 Load
方法中呼叫 方法。
// 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
備註
這個屬性代表控制項所顯示的文字。
警告
控制項 StatusBar 只會顯示字串的前 127 個字元。