InputLanguageChangedEventArgs 类

定义

InputLanguageChanged 事件提供数据。

public ref class InputLanguageChangedEventArgs : EventArgs
public class InputLanguageChangedEventArgs : EventArgs
type InputLanguageChangedEventArgs = class
    inherit EventArgs
Public Class InputLanguageChangedEventArgs
Inherits EventArgs
继承
InputLanguageChangedEventArgs

示例

以下示例创建一个新的 Form ,并将事件处理程序附加到 事件 InputLanguageChanged 。 当输入语言更改为 IMEmode 日语时,此事件会更改 。

#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 ref class Form1: public System::Windows::Forms::Form
{
private:
   RichTextBox^ rtb;

public:
   Form1()
   {
      rtb = gcnew RichTextBox;
      this->Controls->Add( rtb );
      rtb->Dock = DockStyle::Fill;
      this->InputLanguageChanged += gcnew 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( "ja" ) )
      {
         rtb->ImeMode = System::Windows::Forms::ImeMode::Katakana;
      }
   }

};

int main()
{
   Application::Run( gcnew Form1 );
}
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());
    }
}
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

注解

可以使用 中的数据 InputLanguageChangedEventArgs 来决定是更改输入法编辑器 (IME) 还是从右到左交换值。 还可以更改 CurrentCulture 线程和属性的 CurrentUICulture ,以便选取不同的资源。

标识 InputLanguageChangedEventArgs 新输入语言的区域设置和字符集。

事件 InputLanguageChangingInputLanguageChanged 事件之前。

构造函数

InputLanguageChangedEventArgs(CultureInfo, Byte)

用指定的区域设置和字符集初始化 InputLanguageChangedEventArgs 类的新实例。

InputLanguageChangedEventArgs(InputLanguage, Byte)

用指定的输入语言和字符集初始化 InputLanguageChangedEventArgs 类的新实例。

属性

CharSet

获取与新输入语言关联的字符集。

Culture

获取输入语言的区域设置。

InputLanguage

获取指示输入语言的值。

方法

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()

返回表示当前对象的字符串。

(继承自 Object)

适用于

另请参阅