StatusBarPanel.BorderStyle プロパティ
ステータス バー パネルの境界線スタイルを取得または設定します。
Public Property BorderStyle As StatusBarPanelBorderStyle
[C#]
public StatusBarPanelBorderStyle BorderStyle {get; set;}
[C++]
public: __property StatusBarPanelBorderStyle get_BorderStyle();public: __property void set_BorderStyle(StatusBarPanelBorderStyle);
[JScript]
public function get BorderStyle() : StatusBarPanelBorderStyle;public function set BorderStyle(StatusBarPanelBorderStyle);
プロパティ値
StatusBarPanelBorderStyle 値の 1 つ。既定値は Sunken です。
例外
例外の種類 | 条件 |
---|---|
InvalidEnumArgumentException | プロパティに代入された値が StatusBarPanelBorderStyle 列挙体のメンバではありません。 |
解説
このプロパティを使用して、 StatusBar コントロール内のあるパネルをその他のパネルと区別できます。
使用例
[Visual Basic, C#, C++] フォームに StatusBar コントロールを作成し、2 つの StatusBarPanel オブジェクトを追加する例を次に示します。 StatusBarPanel オブジェクトの 1 つである panel1
は、アプリケーションのステータス テキストを表示します。 panel2
という名前の 2 番目の StatusBarPanel オブジェクトは、現在の日付を表示し、 StatusBarPanel クラスの ToolTipText プロパティを使用して現在の時刻を表示します。この例では、標準パネルの代わりにこれらのパネルが表示されるようにするために ShowPanels プロパティを使用し、さらに Panels プロパティを使用して StatusBar.StatusBarPanelCollection の Add メソッドにアクセスして StatusBar にパネルを追加します。また、 StatusBarPanel オブジェクトを初期化するために、 AutoSize 、 BorderStyle 、 ToolTipText 、 Text の各プロパティも使用します。この例は、コード内で定義されたメソッドが定義されており、 Form のコンストラクタから呼び出されることを前提にしています。
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 current time.
panel2.ToolTipText = 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
[C#]
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 the current time.
panel2.ToolTipText = 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);
}
[C++]
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 = S"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 current time.
panel2->ToolTipText = 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);
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
StatusBarPanel クラス | StatusBarPanel メンバ | System.Windows.Forms 名前空間 | StatusBarPanelBorderStyle