在状态栏中显示当前操作员

Posted on 2018-12-25 22:46  努力成长静待花开  阅读(216)  评论(0编辑  收藏  举报

实现效果:

  

知识运用:

  ToolStripStatusLabel控件的Text属性

  public virtual string Text { get;set }

实现代码:

        private void Form1_Load(object sender, EventArgs e)
        {
            Login login = new Login();                  //创建窗体对象
            login.Owner = this;                         //设置Owner属性
            login.ShowDialog();                         //显示窗体
            if (Login.cmd == 0)                         //登陆失败
                Application.Exit();                     //程序退出
            toolStripStatusLabel1.Text = "当前用户: " + Login.user; //显示当前用户
        }