当前位置: 首页>>代码示例>>C#>>正文


C# StatusBarPanel.ToolTipText属性代码示例

本文整理汇总了C#中System.Windows.Forms.StatusBarPanel.ToolTipText属性的典型用法代码示例。如果您正苦于以下问题:C# StatusBarPanel.ToolTipText属性的具体用法?C# StatusBarPanel.ToolTipText怎么用?C# StatusBarPanel.ToolTipText使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在System.Windows.Forms.StatusBarPanel的用法示例。


在下文中一共展示了StatusBarPanel.ToolTipText属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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,代码来源:StatusBarPanel.ToolTipText

示例2: Main

//引入命名空间
using System;
using System.Drawing;
using System.Windows.Forms;
   
class DateAndTimeStatus: Form
{
     StatusBarPanel sbpMenu, sbpDate, sbpTime;
   
     public static void Main()
     {
          Application.Run(new DateAndTimeStatus());
     }
     public DateAndTimeStatus()
     {
          StatusBar sb = new StatusBar();
          sb.Parent = this;
          sb.ShowPanels = true;
   
          sbpMenu = new StatusBarPanel();
          sbpMenu.Text = "Reserved for menu help";
          sbpMenu.BorderStyle = StatusBarPanelBorderStyle.None;
          sbpMenu.AutoSize = StatusBarPanelAutoSize.Spring;
   
          sbpDate = new StatusBarPanel();
          sbpDate.AutoSize = StatusBarPanelAutoSize.Contents;
          sbpDate.ToolTipText = "The current date";
   
          sbpTime = new StatusBarPanel();
          sbpTime.AutoSize = StatusBarPanelAutoSize.Contents;
          sbpTime.ToolTipText = "The current time";
   
          sb.Panels.AddRange(new StatusBarPanel[] 
                                        { sbpMenu, sbpDate, sbpTime });
   
          Timer timer = new Timer();
          timer.Tick += new EventHandler(TimerOnTick);
          timer.Interval = 1000;
          timer.Start();
     }
     void TimerOnTick(object obj, EventArgs ea)
     {
          DateTime dt = DateTime.Now;
   
          sbpDate.Text = dt.ToShortDateString();
          sbpTime.Text = dt.ToShortTimeString();
     }
}
开发者ID:C#程序员,项目名称:System.Windows.Forms,代码行数:48,代码来源:StatusBarPanel.ToolTipText


注:本文中的System.Windows.Forms.StatusBarPanel.ToolTipText属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。