首先Boolean textboxHasText = false;//判断输入框是否有文本
private void Textbox_Enter(object sender, EventArgs e) { if (textboxHasText == false) Textbox.Text = ""; //为空 Textbox.ForeColor = Color.Black; //颜色 } //textbox失去焦点的事件方法 private void Textbox_Leave(object sender, EventArgs e) { if (Textbox.Text == "") { Textbox.Text = "你要让他提示内容"; Textbox.ForeColor = Color.LightGray; //颜色 textboxHasText = false; } else textboxHasText = true; }