當前位置: 首頁>>代碼示例>>C#>>正文


C# StatusBar.StatusBarPanelCollection類代碼示例

本文整理匯總了C#中System.Windows.Forms.StatusBar.StatusBarPanelCollection的典型用法代碼示例。如果您正苦於以下問題:C# StatusBar.StatusBarPanelCollection類的具體用法?C# StatusBar.StatusBarPanelCollection怎麽用?C# StatusBar.StatusBarPanelCollection使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StatusBar.StatusBarPanelCollection類屬於System.Windows.Forms命名空間,在下文中一共展示了StatusBar.StatusBarPanelCollection類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CreateMyStatusBar

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);
}
開發者ID:.NET開發者,項目名稱:System.Windows.Forms,代碼行數:35,代碼來源:StatusBar.StatusBarPanelCollection


注:本文中的System.Windows.Forms.StatusBar.StatusBarPanelCollection類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。