private bool flag1 = true;
private string ImgClosePath = Application.StartupPath.Replace("\\bin\\Debug", "\\Image") + "\\gaitubao_close_png.png"; //图片相对路径+关闭图片存放文件夹路径
private string ImgShowPath = Application.StartupPath.Replace("\\bin\\Debug", "\\Image") + "\\gaitubao_show_png.png"; //图片相对路径+显示图片存放文件夹路径
图片单击事件,输入框显示原文,或是显示星号*
private void pb_OldPw_Click(object sender, EventArgs e)
{
if (flag1)
{
tb_OldPassword.PasswordChar = '\0'; //显示原文
pb_OldPw.Image = Image.FromFile(ImgShowPath); //更换显示原文图标
flag1 = false;
}
else
{
tb_OldPassword.PasswordChar = '*'; //显示*
pb_OldPw.Image = Image.FromFile(ImgClosePath); //更换显示*图片
flag1 = true;
}
}