用户输入密码时,需要隐藏密码,故使用密码文本功能。

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 密码文本控件
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
textBox1.ReadOnly = true;
textBox1.UseSystemPasswordChar = true;
button1.BackColor = Color.Gray;
button1.FlatStyle = FlatStyle.Standard;
}
//输出按钮
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = "12345678";
}
}
}
博客提到在用户输入密码时,为保证密码安全需将其隐藏,可使用密码文本功能来实现,涉及C#、.NET和UI相关知识。
269

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



