textbox提示
作者:互联网
private void textBox1_MouseDown(object sender, MouseEventArgs e)
{
if (textBox1.Text.Equals(textBoxNotice))
{
this.textBox1.ForeColor = Color.Black;
textBox1.Text = "";
}
}
private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
if (textBox1.Text.Length == 0)
{
this.textBox1.ForeColor = SystemColors.ScrollBar;
textBox1.Text = textBoxNotice;
}
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (textBox1.Text.Contains(textBoxNotice))
{
this.textBox1.ForeColor = Color.Black;
textBox1.Text = textBox1.Text.Replace(textBoxNotice, "");
}
}
标签:textBoxNotice,提示,Text,void,private,textBox1,ForeColor,textbox 来源: https://blog.csdn.net/batjhwxf/article/details/98046583