有没有办法将 ListView 控件的特定列中的文本转换为密码字符?谢谢。
最佳答案
使用 ObjectListView (围绕 .NET WinForms ListView 的开源包装器)。它几乎使有关 ListView 的一切变得不那么痛苦——有时甚至很有趣。
在这种情况下,您将使用 AspectToStringConverter
委托(delegate),它负责将值转换为您希望在 ListView 中显示的字符串:
this.olv1.passwordColumn.AspectToStringConverter = delegate(object value) {
string password = (string)value;
if (String.IsNullOrEmpty(password))
return String.Empty;
else
return new String('*', password.Length);
}
关于C# - 将 ListView 列中的文本转换为密码字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1603585/