当前位置: 首页>>代码示例>>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;未经允许,请勿转载。