StatusBarPanel.BorderStyle プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文
Dim instance As StatusBarPanel Dim value As StatusBarPanelBorderStyle value = instance.BorderStyle instance.BorderStyle = value
public: property StatusBarPanelBorderStyle BorderStyle { StatusBarPanelBorderStyle get (); void set (StatusBarPanelBorderStyle value); }
/** @property */ public StatusBarPanelBorderStyle get_BorderStyle () /** @property */ public void set_BorderStyle (StatusBarPanelBorderStyle value)
public function get BorderStyle () : StatusBarPanelBorderStyle public function set BorderStyle (value : StatusBarPanelBorderStyle)
StatusBarPanelBorderStyle 値の 1 つ。既定値は Sunken です。
解説
使用例
フォームに StatusBar コントロールを作成し、2 つの StatusBarPanel オブジェクトを追加するコード例を次に示します。panel1 という名前の一方の StatusBarPanel は、アプリケーションのステータスを表すテキストを表示します。panel2 という名前のもう一方の 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 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. Me.Controls.Add(statusBar1) End Sub
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); }
private: void CreateMyStatusBar() { // Create a StatusBar control. StatusBar^ statusBar1 = gcnew StatusBar; // Create two StatusBarPanel objects to display in the StatusBar. StatusBarPanel^ panel1 = gcnew StatusBarPanel; StatusBarPanel^ panel2 = gcnew 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 time the application // was started. panel2->ToolTipText = System::DateTime::Now.ToShortTimeString(); // Set the text of the panel to the current date. panel2->Text = "Started: " + 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 ); }
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.set_BorderStyle(StatusBarPanelBorderStyle.Sunken); // Initialize the text of the panel. panel1.set_Text("Ready..."); // Set the AutoSize property to use all remaining space on the StatusBar. panel1.set_AutoSize(StatusBarPanelAutoSize.Spring); // Display the second panel with a raised border style. panel2.set_BorderStyle(StatusBarPanelBorderStyle.Raised); // Create ToolTip text that displays the time the application was started. panel2.set_ToolTipText("Started: " + System.DateTime.get_Now().ToShortTimeString()); // Set the text of the panel to the current date. panel2.set_Text(System.DateTime.get_Today().ToLongDateString()); // Set the AutoSize property to size the panel to the size of the // contents. panel2.set_AutoSize(StatusBarPanelAutoSize.Contents); // Display panels in the StatusBar control. statusBar1.set_ShowPanels(true); // Add both panels to the StatusBarPanelCollection of the StatusBar. statusBar1.get_Panels().Add(panel1); statusBar1.get_Panels().Add(panel2); // Add the StatusBar to the form. this.get_Controls().Add(statusBar1); } //CreateMyStatusBar
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- StatusBarPanel.BorderStyle プロパティのページへのリンク