//登录窗口初始化 private void login_Load(object sender, EventArgs e) { label6.Text = ""; identity.SelectedIndex = 0; //登录系统的身份默认是学生 MaximizeBox = false; //关闭登录窗口的最大化功能 Verification_Code.Text = YanZhenMa.Code(); //动态生成验证码 DoLogin.Enabled = false; //默认在不输入验证码时无法点击登录按钮 //-------------------------测试数据开始------------------------- //学生测试数据 //Tusername.Text = "jie"; //Tpass.Text = "jie"; //管理员测试数据 //Tusername.Text = "ad"; //Tpass.Text = "ad"; //identity.SelectedIndex = 2; //教师测试数据 //Tusername.Text = "te"; //Tpass.Text = "te"; //identity.SelectedIndex = 1; //Verification_Code_in.Text = Verification_Code.Text;//测试时将填写验证码的步骤省略 //DoLogin.Enabled = true; //辅助测试 //-------------------------测试数据结束------------------------- }
//注册界面初始化 private void regist_Load(object sender, EventArgs e) { MaximizeBox = false; //关闭注册窗口的最大化功能 RegistIdentity.SelectedIndex = 2; //设置下拉菜单的默认选项 //将所有提示信息的lable置空 label8.Text = "*必填"; label9.Text = "*必填"; label11.Text = "*必填"; label12.Text = ""; label14.Text = "*必填"; button1.Enabled = false; //用户未输入注册信息时,默认注册按钮不可点击 PuanDuanSF.panduanshenfen(RegistIdentity.SelectedIndex); //根据用户选择的值判断用户身份 if (quanju.sf.Equals("s")) { label2.Text = "学生注册"; this.Text = "学生注册"; } else { label2.Text = "教师注册"; this.Text = "教师注册"; } label2.Text = "选择身份"; this.Text = "注册"; Verification_Code.Text = YanZhenMa.Code(); //加载验证码 panel1.Visible = false; //未选择注册身份之前默认不显示所有输入框 }
//选择用户身份改变时触发的事件 private void RegistIdentity_SelectedIndexChanged(object sender, EventArgs e) { PuanDuanSF.panduanshenfen(RegistIdentity.SelectedIndex);//根据用户选择的值判断用户身份 if (quanju.sf.Equals("s")) { label2.Text = "学生注册"; this.Text = "学生注册"; label6.Text = "学号:"; } else { label2.Text = "教师注册"; this.Text = "教师注册"; label6.Text = "教师编号:"; } Verification_Code.Text = YanZhenMa.Code(); //刷新验证码 panel1.Visible = true; //显示用户输入面板 if (RegistIdentity.SelectedIndex == 2) { label2.Text = "选择身份"; this.Text = "注册"; panel1.Visible = false; } }
//用户点击取消事件 private void DoNo_Click(object sender, EventArgs e) { Verification_Code.Text = YanZhenMa.Code(); //刷新验证码 Tusername.Text = ""; //将用户输入的信息置空 Tpass.Text = ""; }