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 _01 { public partial class Form1 : Form { public Form1() { InitializeComponent(); label4.Visible = false; label5.Visible = false; } private void button1_Click(object sender, EventArgs e) { label4.Visible = false; label5.Visible = false; label6.Visible = false; string a = "123", a1 = "123"; textBox1.Text = textBox1.Text.Trim(); textBox2.Text = textBox2.Text.Trim(); label4.Visible = (textBox1.Text == "") ? true : false; if (label4.Visible == false) { label5.Visible = (textBox2.Text == "") ? true : false; } if (label4.Visible == false && label5.Visible == false) { bool con = (textBox1.Text == a && textBox2.Text == a1) ? true : false; label6.ForeColor = con ? Color.Green : Color.Red; label6.Text = con ? "登录成功" : "账号或密码错误"; label6.Visible = true; } } } }
标签:false,登录,Text,系统,System,label4,Visible,using From: https://www.cnblogs.com/wangyihang-xh/p/18262359