又来麻烦大家了,想问下textbox水印怎么做,是不是有专门的程序设计,我利用了光标进入、离开用户框及密码框的事件实现的,但问题来了,我在这两个控件点了多次后,密码框不在显示“请输入密码:”,而是显示“***”,这不是我想要的效果,还请大家帮忙看下哪里出错了,谢谢你了
#region 默认显示输入账号及密码提示
private void txb_Psd_Enter(object sender, EventArgs e)
{
if(txb_Psd.Text=="请输入密码:")
{
txb_Psd.Text = "";
txb_Psd.ForeColor=Color.Black;
txb_Psd.PasswordChar = Convert.ToChar("*");
}
}
private void txb_Psd_Leave(object sender, EventArgs e)
{
if (txb_Psd.Text == "")
{
txb_Psd.Text = "请输入密码:";
txb_Psd.ForeColor = Color.DarkGray;
}
}
private void cmb_Account_Enter(object sender, EventArgs e)
{
if(cmb_Account.Text=="请输入账号:")
{
cmb_Account.Text = "";
cmb_Account.ForeColor = Color.Black;
}
}
private void cmb_Account_Leave(object sender, EventArgs e)
{
if (cmb_Account.Text == "")
{
cmb_Account.Text = "请输入账号:";
cmb_Account.ForeColor = Color.DarkGray;
}
}
#endregion
|
|