zoukankan      html  css  js  c++  java
  • 程序运行时智能增减控件

    实现效果:

      

    知识运用:

      Button控件的Visible属性

      Form窗体的Show方法和Hide方法

    实现代码:

            Frm frm = new Frm();
            private void button1_Click(object sender, EventArgs e)
            {
                if (txt_user.Text == "" || txt_pwd.Text == "")
                    return;
                else if (txt_user.Text == "admin" && txt_pwd.Text == "admin")
                {
                    frm.Text += "   "+"登陆用户:"+txt_user.Text;
                    frm.Show();
                    this.Hide();
                }
                else if (txt_user.Text == "user" && txt_pwd.Text == "user")
                {
                    frm.Text += "   " + "登陆用户:" + txt_user.Text;
                    frm.Show();
                    frm.button3.Visible = false;
                    frm.button4.Visible = false;
                    this.Hide();
                }
                else 
                {
                    MessageBox.Show("用户名或密码输有误");
                    txt_user.Text = "";
                    txt_pwd.Text = "";
                    txt_user.Focus();
                }
            }
    
  • 相关阅读:
    精妙SQL语句介绍
    ASP判断文件地址是否有效
    将源代码清空,这样别人就看不到源码了
    部署
    sublime
    vscode
    android node
    mac开启热点
    微信
    常见问题
  • 原文地址:https://www.cnblogs.com/feiyucha/p/10200618.html
Copyright © 2011-2022 走看看