登入介面(C#)

陈若麟發表於2024-06-22
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;
            }
        }
    }
}

  

相關文章