Incorporating the Windows 7 onscreen keyboard into a WPF app

心已入冬 提交于 2019-12-30 00:40:09

问题


Windows 7 has a really nice onscreen keyboard program/control for touchscreens. I have a touchscreen app that was originally written for, and will be deployed on, XP. Is it possible to incorporate this keyboard directly into my app, rather than me using a custom control? I can find no programmatic information about it, so any links would be very helpful. Specifically, I'd need:

  1. To be able to use the keyboard on an XP machine that will have .NET 3.5 sp1 installed on it.
  2. To be able to hide the native keyboard on Windows 7, because I've already incorporated the touchscreen keyboard in my UI and so I don't need another one cluttering up the UI.

This native keyboard has two attractive aspects to it. First off, it's automatically localized to the customer's language (though the rest of the app will need modification), and second off, it doesn't seem to suffer from 'touch lag' as the OS tries to figure out whether or not I'm doing a gesture, because I'm clearly typing on a keyboard.

The app is WPF based, which should mean easy integration with Windows 7 based controls.

EDIT: I'd really like the XP thing, but it's not a requirement. The ability to use the keyboard in Win7, though, seems like it should be possible and even the right way to do it.


回答1:


The best thing I've found is this:

http://interactiveasp.net/blogs/natesstuff/archive/2008/10/01/ink-in-wpf-using-textinputpanel-for-text-input.aspx

It's using an interop out of WPF, but seems to work really well.

EDIT: I wish I was the one who actually wrote it, but all I did was find it...




回答2:


Simply put, I doubt it. If you were trying to use the Windows 7 keyboard in your own application that was running on Windows 7- maybe. But what you're talking about is trying to run a Windows 7 OS-level component inside your own application that's running on XP- two operating systems out of date. And heck, I don't even know if you could get it running in your application if it was built on Windows 7.

Our product also needed to use an integrated on-screen keyboard, and we were unable to find any alternatives short of buying one that someone else had made, or rolling our own. We found no easy interoperability solutions with the OS keyboard. But we did manage to create our own and have it fully tested in a few weeks. So it wasn't too bad. I would go that route.




回答3:


For attach a custom onscreen keyboard layout in wpf application, use the attached property. You will get the clear idea from Ben Constable's Ramora Pattern: http://blogs.msdn.com/b/bencon/archive/2006/07/26/more-advanced-attached-property-use-the-ramora-pattern.aspx

And you can find source code from here: http://www.codeproject.com/KB/WPF/TouchScreenKeyboardWPF.aspx

Thanks,



来源:https://stackoverflow.com/questions/1168203/incorporating-the-windows-7-onscreen-keyboard-into-a-wpf-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!