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 WindowsFormsApplication2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); label6.Hide(); } private void textBox1_TextChanged(object sender, EventArgs e) { if (textBox1.Text == "") { label3.Show(); return; }else{ label3.Hide(); return; } } private void textBox2_TextChanged(object sender, EventArgs e) { if (textBox2.Text == "") { label4.Show(); return; } else { label4.Hide(); return; } } private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "hanxuyao" && textBox2.Text == "123456") { label6.Text = "正确"; label6.ForeColor = Color.Green; label6.Show(); } else { label6.Text = "错误"; label6.ForeColor = Color.Red; label6.Show(); } } } }
标签:控件,return,Show,Text,System,label6,类型,using,文本 From: https://www.cnblogs.com/hanxuyao/p/18262367