c#statusStrip样例

      private void Form1_Load(object sender, EventArgs e)
        { 
            statusStrip1.Items.Insert(1, new ToolStripSeparator());//1是索引,数控件位置从0开始
            statusStrip1.Items.Insert(3, new ToolStripSeparator());//工具箱中拖进来的
            toolStripStatusLabel1.Text = "11111111";
            toolStripStatusLabel1.Spring = true;//弹性填充,可在控件属性列表找到改或此代码设置
            toolStripStatusLabel2.Text = "版权所有";
            toolStripStatusLabel3.Text= "系统当前时间:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
            //this.timer1.Enabled = true;//使用即启用
            this.timer1.Interval = 1000;
            this.timer1.Start();

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.toolStripStatusLabel3.Text = "系统当前时间:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
        }

 

posted @ 2024-08-30 16:48  techNote  阅读(14)  评论(0编辑  收藏  举报