StatusBarPanel.BorderStyle プロパティ

定義

ステータス バー パネルの境界線スタイルを取得または設定します。

C#
public System.Windows.Forms.StatusBarPanelBorderStyle BorderStyle { get; set; }

プロパティ値

StatusBarPanelBorderStyle 値のいずれか 1 つ。 既定値は、Sunken です。

例外

プロパティに割り当てられている値は StatusBarPanelBorderStyle 列挙体のメンバーではありません。

次のコード例では、フォームにコントロールを StatusBar 作成し、2 つの StatusBarPanel オブジェクトを追加します。 という名前panel1の最初StatusBarPanelの は、アプリケーションの状態テキストを表示します。 という名前panel2の 2 つ目StatusBarPanelの は、現在の日付を表示し、 クラスの プロパティをStatusBarPanel使用ToolTipTextして現在の時刻を表示します。 この例では、 プロパティをShowPanels使用して、標準パネルではなくパネルが表示されるようにし、 プロパティをPanels使用して の StatusBar.StatusBarPanelCollection メソッドにアクセスAddし、パネルを にStatusBar追加します。 また、および Text の各プロパティをToolTipTextAutoSizeBorderStyle使用してオブジェクトをStatusBarPanel初期化します。 この例では、例で定義されているメソッドが 定義され、 の Formコンストラクターから呼び出されることを前提としています。

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 time the application was started.
    panel2.ToolTipText = "Started: " + 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);
}

注釈

このプロパティを使用すると、コントロール内の他のパネルとパネルを StatusBar 区別できます。

適用対象

製品 バージョン
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 10

こちらもご覧ください