WPF PasswordBox:如何警告用户大写锁定已启用?

发布于 2024-07-09 04:30:42 字数 84 浏览 6 评论 0原文

有谁知道如何实现标准气泡消息,每当启用大写锁定并且密码控件获得焦点时都会警告用户? 这是内置于 .NET 框架中的,还是我需要编写自己的类来执行此操作?

Does anyone know how to implement the standard bubble message that warns users whenever Caps Lock is enabled and a password control has focus? Is this built into the .NET framework, or do I need to write my own class to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

北渚 2024-07-16 04:30:42

这是一个老问题,已经回答了,但我遇到了同样的问题,我首先从 Keyboard.IsKeyToggled(Key.CapsLock) 开始,但如果 Caps 返回 false锁定是在应用程序运行之前设置的。 所以我找到了另一个完美的解决方案。

Console.CapsLock //is boolean and returns true if CapsLock is on

绝对出色且简单(它位于 mscorlib dll 中,因此您也不必担心不需要的依赖项)

This is an old question, and already answered, but I came across this same problem and I first started with Keyboard.IsKeyToggled(Key.CapsLock) but that returned false if Caps Lock was set prior to the application running. So I found another solution that works perfectly.

Console.CapsLock //is boolean and returns true if CapsLock is on

Absolutely brilliant and simple (it's in the mscorlib dll so you don't have to worry about unneeded dependencies either)

笑脸一如从前 2024-07-16 04:30:42

You could add a handler function to the PasswordChanged event handler and test for the value of the CapsLock key in that function. If found to be on, you could pop-up a message from there.

太阳哥哥 2024-07-16 04:30:42

如果您使用 MaskedTextBox 并指定密码字符,.NET 框架将自动为您执行此操作

If you use a MaskedTextBox and specify a passwordChar the .NET framework will automatically do this for you

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文