C#学习6(动态更新状态栏信息)

来源:互联网 发布:python搭建webservice 编辑:程序博客网 时间:2024/05/29 03:43

实现状态栏的上述信息。

1.新建一个Form1窗体。

2.添加菜单栏menuStrip,工具栏toolStrip,  状态栏,statusStrip.

3.在statusStrip中添加toolStripStatusLable1-4;

4,.添加timer控件,设置Enabled的属性为true;

然后在timer控件中编写如下代码:

  private void timer1_Tick(object sender, EventArgs e)        {            string message = string.Format("{0}, {1}", MousePosition.X.ToString(), MousePosition.Y.ToString());            this.toolStripStatusLabel2.Text = message;            this.toolStripStatusLabel4.Text = DateTime.Now.ToLongTimeString();        }



0 0
原创粉丝点击