InputLanguage::FromCulture Method (CultureInfo^)
Returns the input language associated with the specified culture.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Parameters
- culture
-
Type:
System.Globalization::CultureInfo^
The CultureInfo that specifies the culture to convert from.
Return Value
Type: System.Windows.Forms::InputLanguage^An InputLanguage that represents the previously selected input language.
The FromCulture method selects from among installed keyboards. Specifically, this method performs the following operations:
Gets the LCID associated with culture.
Gets the full list of available input language identifiers (HKLs) from the GetKeyboardLayoutList function.
Finds the HKL that corresponds to the LCID from culture, if one is present.
Returns the installed keyboard associated with that HKL.
If no keyboard is found, returns null.
Note |
|---|
The FromCulture method never tries to load or install an additional keyboard if one has not already been installed for culture. Use the Platform SDK function, LoadKeyboardLayout, to install an additional keyboard. |
The following code example sets the default input language as the current input language.
First, DefaultInputLanguage is called to get the system default language. Next, CurrentInputLanguage is called to get the current input language. The results are printed in a text box. Then, calling CurrentInputLanguage with the default input language changes the current input language to the default. The new current input language is displayed in a text box.
This code assumes that textBox1 has been instantiated.
public: void SetNewCurrentLanguage() { // Gets the default, and current languages. InputLanguage^ myDefaultLanguage = InputLanguage::DefaultInputLanguage; InputLanguage^ myCurrentLanguage = InputLanguage::CurrentInputLanguage; textBox1->Text = String::Format( "{0}Current input language is: {1}\n", myCurrentLanguage->Culture->EnglishName, myDefaultLanguage->Culture->EnglishName ); //Print the new current input language. InputLanguage^ myCurrentLanguage2 = InputLanguage::CurrentInputLanguage; textBox1->Text = String::Format( "{0}New current input language is: {1}", textBox1->Text, myCurrentLanguage2->Culture->EnglishName ); }
Available since 1.1
