Keyboards - Is there a way?
I am building a word processor in C# which uses Hebrew, Greek, and English. The context is C# with a VS 2008 RichTextBox. The user may switch back and forth between any of the 3 languages. At present I am uploading key assignments from an XML file into a SortedDictionary. I then use key events and ProcessCmdKey() to intercept events, and then SendKeys() to replace the keyCode with the dictionary code (ie. Hebrew key assignments, etc.). I find this all rather an ugly way to reassign the keyboard, so I'm looking for a better solution. I don't really want to simply start up the editor and then choose a language from the language bar. It must be internal to the program, and easily changeable to one of the other 2 from within.
As I said, I have a working solution right now, but I think it is rather crude. I am new to C# and .Net, so this may well be simply a statement of my naiveté. but I sure would appreciate some feedback on this. I have been poking around in the Registry, and it seems like the solution is right there, but I'm not sure just how to tie into the stored keyboards in the sense of assigning them to the physical keyboard for the duration of the session - or if such a thing is even possible.
Love to hear some comment.
Re: Keyboards - Is there a way?
You might check out the CultureInfo class in msdn. Then look at the Thread CurrentCulture and CurrentUICulture properties. I know this will change the display and number formats, but not sure if it alters the keyboard mappings.