How to use PasswordBox as TextBox?(如何将密码框用作文本框?)
问题描述
我有一个PasswordBox
,我需要将此控件even 用作TextBox
.我需要显示普通文本而不是典型的黑点
I have a PasswordBox
and I need to use this control even as a TextBox
.
I need to display normal text and not the typical black dots
有没有属性可以做到这一点?谢谢.
Is there a property to do this? Thanks.
推荐答案
这是你的答案:
- 使用文本框
- 当你想要文本被屏蔽时设置TextBox.UseSystemPasswordChar = true;
- 当你想看文本时设置TextBox.UseSystemPasswordChar = false;
- 利润
例子:
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
{
TextBox.UseSystemPasswordChar = true;
}
else
{
TextBox.UseSystemPasswordChar = false;
}
}
黑点当你想要它们时,单词当你不需要时.您可以使用您想要的任何触发器/逻辑来打开和关闭,但这样您只使用一个控件并获得您指定所需的所有功能.
Black dots when you want them, words when you don't. You can use what ever trigger/logic you want for the turning on and off but this way you are only using one control and get all the functionality that you specified you needed.
这篇关于如何将密码框用作文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将密码框用作文本框?


基础教程推荐
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01