.NET Password field that looks like Windows XP password field

Here's a trick to make your regular .NET TextBox to have a look similar to Windows XP password field, where it displays large black circles instead of asterisks (****) to "mask" the password (see the Password field shown in the screenshot below):



This trick is fairly easy, and it doesn't require you to perform any complicated owner drawings.

Here's how:

1. Add a TextBox to your Form
2. Set the Font of that TextBox to Wingdings (not Webdings)
3. Set the PasswordChar property to small letter L ('l').

And you're all set, quick and easy.

If you want your password field to have customized look and feel other than the one I described, you may want to experiment using different characters other than small letter L, or use Symbols Font, for more symbols.

Happy coding

-chris

Published 09-21-2006 11:17 PM by cvega
Filed under:

Comments

# re: .NET Password field that looks like Windows XP password field

Thursday, September 21, 2006 9:29 PM by Orange

Tricky.