none
'Ctrl' key in localized Windows systems RRS feed

  • Question

  • We are developing application which will be installed on different localization Windows versions. In this application we are using xml files for shortcut definitions (e.g. "Ctrl+S"). When we will run this application on US Win everything works fine. As soon as this application is executod on DE localization Win system exception will occure.

    This exception will say that Value "Ctrl" can't be found. I think this will occure because 'Ctrl' in german localization is "Strg". For conversion we are using KeysConverter class and method call ConvertFromInvariantString.

    I think we can use method which will consume some CultureInfo as parameter but there will be still possibility that such culture will not be installed on system.

    Any idea how we can convert e.g. "Ctrl+S" to Keys representation on any Win localization ?

    Thursday, July 1, 2010 2:52 PM

Answers

  • I think the culture support of KeysConverter is questionable.  I think the full English word Control will be understood regardless of the culture.  To generalize, stick to the key names as found in the documentation for the Keys enum (http://msdn.microsoft.com/en-us/library/system.windows.forms.keys.aspx).

    You might consider one of the following:

    1. Use Control instead in Ctrl in the XML file.

    2. Substitute Control for Ctrl at runtime before calling KeyConverter.

    3. Write your own logic that bypasses KeyConverter entirely.

     

    • Marked as answer by Julius.Petko Saturday, July 3, 2010 9:12 PM
    Thursday, July 1, 2010 11:32 PM