private string Notes = "提示文本"; private void textBox1_Leave(object sender, EventArgs e) {// 退出失去焦点,重新显示if (string.IsNullOrEmpty(textBox1.Text)){textBox1.ForeColor = Color.DarkGray;this.textBox1.Text = Notes;} }private void textBox1_Enter(object sender, EventArgs e) {// 进入获得焦点,清空if (textBox1.Text == Notes){textBox1.ForeColor = Color.Black;this.textBox1.Text = "";} }