一,页面部分展示

我们一起来一把.....现在学习真的好累,一天下来脑袋要炸

 

我们一起来一把.....现在学习真的好累,一天下来脑袋要炸

 

我们一起来一把.....现在学习真的好累,一天下来脑袋要炸

 

我们一起来一把.....现在学习真的好累,一天下来脑袋要炸

我们一起来一把.....现在学习真的好累,一天下来脑袋要炸

 

 二.代码展示

1.登录页面:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
public partial class FrmLogin : Form
    {
        public FrmLogin()
        {
            InitializeComponent();
             
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() == "" || textBox2.Text.Trim() == "")
            {
                MessageBox.Show("用户名或密码不为空!""提示");
            }else if(textBox1.Text==FrmRegist.name&&textBox2.Text==FrmRegist.pwd){
 
                FrnMain fm = new FrnMain();
                fm.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("用户名或密码错误!""提示");
            }
        }
       
        private void FrmLogin_Load(object sender, EventArgs e)
        {
            
 
        }
 
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            FrmRegist fr = new FrmRegist();
             
            fr.Show();
            this.Hide();
        }

  2.注册页面:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
public partial class FrmRegist : Form
    {
        public static string name;
        public static string pwd;
        public static string name2;
        public FrmRegist()
        {
            InitializeComponent();
        }
 
        private void pictureBox1_Click(object sender, EventArgs e)
        {
 
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
 
            if (textBox3.Text == textBox5.Text && textBox4.Text == textBox6.Text && textBox3.Text != "" && textBox4.Text != "" && textBox5.Text != "" && textBox6.Text != "")
            {
                name = textBox3.Text;
                pwd = textBox4.Text;
                name2 = textBox1.Text;
                MessageBox.Show("注册成功!");
                FrmLogin fm = new FrmLogin();
                fm.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("注册失败");
            }
        }

  3.主页面:

1
2
3
4
5
6
7
8
9
10
11
12
public partial class FrnMain : Form
    {
        public FrnMain()
        {
            InitializeComponent();
        }
        public FrmLogin f1;
        private void FrnMain_Load(object sender, EventArgs e)
        {
            lblname.Text = FrmRegist.name2;
        }
    } 

相关文章:

  • 2021-07-03
  • 2021-05-03
  • 2021-04-25
  • 2021-08-31
  • 2021-08-04
  • 2021-06-21
  • 2021-06-25
  • 2021-09-04
猜你喜欢
  • 2022-12-23
  • 2021-12-02
  • 2021-08-14
  • 2021-10-04
  • 2021-07-23
  • 2021-07-18
  • 2022-01-02
相关资源
相似解决方案