Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

InputLanguageChangedEventArgs Class

Provides data for the InputLanguageChanged event.

For a list of all members of this type, see InputLanguageChangedEventArgs Members.

System.Object
   System.EventArgs
      System.Windows.Forms.InputLanguageChangedEventArgs

[Visual Basic]
Public Class InputLanguageChangedEventArgs
   Inherits EventArgs
[C#]
public class InputLanguageChangedEventArgs : EventArgs
[C++]
public __gc class InputLanguageChangedEventArgs : public EventArgs
[JScript]
public class InputLanguageChangedEventArgs extends EventArgs

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

You can use the data from the InputLanguageChangedEventArgs to make decisions about whether to change Input Method Editors (IMEs) or swap right-to-left values. You can also change the CurrentCulture of a thread and the CurrentUICulture properties so that different resources get picked up.

An InputLanguageChangedEventArgs identifies the locale and the character set of the new input language.

The InputLanguageChanging event precedes the InputLanguageChanged event.

Example

[Visual Basic, C#, C++] The following example creates a new Form and attaches an event handler to the InputLanguageChanged event. This event changes the IMEmode when the input language changes to Japanese.

[Visual Basic] 
Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data

Public Class Form1
   Inherits System.Windows.Forms.Form
   
   Dim WithEvents rtb As New RichTextBox()
   
   Public Sub New()
      MyBase.New()
      Me.Controls.Add(rtb)
      rtb.Dock = DockStyle.Fill
   End Sub

   Private Sub languageChange( _
      ByVal sender As Object, _
      ByVal e As InputLanguageChangedEventArgs _
   ) Handles MyBase.InputLanguageChanged

      ' If the input language is Japanese.
      ' set the initial IMEMode to Katakana.
      If e.InputLanguage.Culture.TwoLetterISOLanguageName.Equals("ja") = True Then
         rtb.ImeMode = System.Windows.Forms.ImeMode.Katakana
      End If
   End Sub

   Public Shared Sub Main()
      Application.Run(new Form1())
   End Sub

End Class

[C#] 
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class Form1 : System.Windows.Forms.Form
{
    RichTextBox rtb = new RichTextBox();
    public Form1()
    {
        this.Controls.Add(rtb);
        rtb.Dock = DockStyle.Fill;
        this.InputLanguageChanged += new InputLanguageChangedEventHandler(languageChange);
    }
    private void languageChange(Object sender, InputLanguageChangedEventArgs e)
    {
        // If the input language is Japanese.
        // set the initial IMEMode to Katakana.
        if (e.InputLanguage.Culture.TwoLetterISOLanguageName.Equals("ja"))
        {
            rtb.ImeMode = System.Windows.Forms.ImeMode.Katakana;
        }
    }
    public static void Main(string[] args)
    {
        Application.Run(new Form1());
    }
}

[C++] 
#using <mscorlib.dll>
#using <System.Data.dll>
#using <System.Windows.Forms.dll>
#using <System.dll>
#using <System.Drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::Collections;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using namespace System::Data;

public __gc class Form1 : public System::Windows::Forms::Form
{
    RichTextBox* rtb;
public:
    Form1()
    {
        rtb = new RichTextBox();
        this->Controls->Add(rtb);
        rtb->Dock = DockStyle::Fill;
        this->InputLanguageChanged += new InputLanguageChangedEventHandler(this, &Form1::languageChange);
    }
private:
    void languageChange(Object* /*sender*/, InputLanguageChangedEventArgs* e)
    {
        // If the input language is Japanese.
        // set the initial IMEMode to Katakana.
        if (e->InputLanguage->Culture->TwoLetterISOLanguageName->Equals(S"ja"))
        {
            rtb->ImeMode = System::Windows::Forms::ImeMode::Katakana;
        }
    }
};

int main()
{
    Application::Run(new Form1());
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Windows.Forms

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System.Windows.Forms (in System.Windows.Forms.dll)

See Also

InputLanguageChangedEventArgs Members | System.Windows.Forms Namespace | InputLanguage | InputLanguageChangingEventArgs

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.