登录界面(C#)

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            label6.Text = "";
            label4.Hide();
            label5.Hide();
            textBox1.Text = textBox1.Text.Trim();
            textBox2.Text = textBox2.Text.Trim();
            if (textBox1.Text == "") {
                label4.Show();
                return;
            }
            if (textBox2.Text == "") {
                label5.Show();
                return;
            }
            if (textBox1.Text == "chen" && textBox2.Text == "1234")
            {
                label6.Text = "登陆成功,请稍后......";
                label6.ForeColor = Color.Green;
            }
            else {
                label6.Text = "*账号或密码错误";
                label6.ForeColor = Color.Red;
            }
        }
    }
}

  

posted @ 2024-06-22 15:00  陈若麟  阅读(10)  评论(0编辑  收藏  举报