问题
In WPF I have a screen for login which has a textbox for username and a password box for password. I ideally need to prevent the on-screen keyboard from displaying so I can use a custom keyboard in the perfect location in the app. Failing that I need to somehow force the on-screen keyboard to display for the password box.
I've found the Microsoft.Ink.TextInput.TextInputPanel seems to have most of this functionality in .net 3.5, but I can't find an equivalent in .net 4.0
P.S. Any textboxes on other forms need to work as normal, and other applications on the same tablet should ideally also be unaffected, so I'm uncomfortable with surpressing the TIP using a registry key.
回答1:
You cannot show / hide the virtual keyboard from .Net managed code. However, as the virtual keyboard is just a standard windows application you can simply show / hide it by starting the appropriate Process.
var virtualKeyboard = new System.Diagnostics.Process();
virtualKeyboard = System.Diagnostics.Process.Start("osk.exe"); // open
virtualKeyboard.Kill(); // close
来源:https://stackoverflow.com/questions/6871347/how-do-i-trigger-or-supress-the-display-of-windows-virtual-keyboard