StatusBar コントロールに関連付けられているテキストを取得または設定します。
名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文
'宣言
<LocalizableAttribute(True)> _
Public Overrides Property Text As String
'使用
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)
プロパティ値
StatusBar コントロールに関連付けられたテキスト。
解説
このプロパティはコントロールによって表示されるテキストを表します。
ヒント
StatusBar コントロールには、文字列の最初の 127 文字しか表示されません。
使用例
Text プロパティを使用する方法を次のコード例に示します。この例を実行するには、次のコードをフォームに貼り付けます。そして、フォームのコンストラクタまたは Load メソッドで InitializeSimpleStatusBar メソッドを呼び出します。
' 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
プラットフォーム
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 2.0、1.1、1.0
.NET Compact Framework
サポート対象 : 2.0、1.0