标签:black leave obj bsp else als ast class 默认
Boolean textboxHasText = false;//判断输入框是否有文本
//触发两个事件 //textbox获得焦点 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; }
标签:black leave obj bsp else als ast class 默认
原文地址:https://www.cnblogs.com/strive-19970713/p/13796701.html