关于winform登录窗体的文本框问题
2021-07-10 02:04
标签:focus rgs log 焦点 help pass tar 关于 win 设置TextBox控件的默认文本即在加载TextBox控件时为其Text文本赋值。点击文本消失,离开或者失去焦点显示默认文本可以通过Enter和Leave事件或Mouse的事件来实现。具体代码如下。 private void txtPassword_Enter(object sender, EventArgs e) if (txtPassword.Text.Trim() == "请输入密码") private void txtPassword_Leave(object sender, EventArgs e) if (txtPassword.Text.Trim().Length == 0) 关于winform登录窗体的文本框问题 标签:focus rgs log 焦点 help pass tar 关于 win 原文地址:https://www.cnblogs.com/q240722328/p/9692142.html
{
pnlPassword.BackgroundImage = ImageHelper.GetImage("Login\\login_account_focus.png");
pnlAccount.BackgroundImage = ImageHelper.GetImage("Login\\login_account_default.png");
{
txtPassword.ForeColor = ColorTranslator.FromHtml("#333333");
txtPassword.Text = "";
txtPassword.PasswordChar = ‘*‘;
}
}
{
pnlPassword.BackgroundImage = ImageHelper.GetImage("Login\\login_account_default.png");
{
txtPassword.ForeColor = ColorTranslator.FromHtml("#999999");
txtPassword.PasswordChar = ‘\0‘;
txtPassword.Text = " 请输入密码";
}
}
上一篇:C#概念总结(三)