using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Txt_PassWord
{
public partial class Frm_Main : Form
{
public Frm_Main()
{
InitializeComponent();
}
private void btn_Str_Click(object sender, EventArgs e)
{
txt_Change.PasswordChar = (char)0;//取消屏蔽
}
private void btn_PassWord_Click(object sender, EventArgs e)
{
txt_Change.PasswordChar = '*';//设置屏蔽字符
}
}
}
此博客展示了一段C#代码,用于实现文本框密码的显示与屏蔽功能。通过设置`PasswordChar`属性,点击不同按钮可取消屏蔽或设置屏蔽字符,代码使用了`System`等多个命名空间。
1395

被折叠的 条评论
为什么被折叠?



