Bewerken

Delen via


InputLanguageChangedEventArgs.CharSet Property

Definition

Gets the character set associated with the new input language.

public:
 property System::Byte CharSet { System::Byte get(); };
public byte CharSet { get; }
member this.CharSet : byte
Public ReadOnly Property CharSet As Byte

Property Value

An 8-bit unsigned integer that corresponds to the character set, as shown in the following table.

Character Set Value
ANSI_CHARSET 0
DEFAULT_CHARSET 1
SYMBOL_CHARSET 2
MAC_CHARSET 77
SHIFTJI_CHARSET 128
HANGEUL_CHARSET 129
HANGUL_CHARSET 129
JOHAB_CHARSET 130
GB2312_CHARSET 134
CHINESEBIG5_CHARSET 136
GREEK_CHARSET 161
TURKISH_CHARSET 162
VIETNAMESE_CHARSET 163
HEBREW_CHARSET 177
ARABIC_CHARSET 178
BALTIC_CHARSET 186
RUSSIAN_CHARSET 204
THAI_CHARSET 222
EASTEUROPE_CHARSET 238
OEM_CHARSET 255

Examples

The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the Form.InputLanguageChanged event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing MessageBox.Show with Console.WriteLine or appending the message to a multiline TextBox.

To run the example code, paste it into a project that contains an instance of type Form named Form1. Then ensure that the event handler is associated with the Form.InputLanguageChanged event.

private void Form1_InputLanguageChanged(Object sender, InputLanguageChangedEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "InputLanguage", e.InputLanguage );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Culture", e.Culture );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "CharSet", e.CharSet );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "InputLanguageChanged Event" );
}
Private Sub Form1_InputLanguageChanged(sender as Object, e as InputLanguageChangedEventArgs) _ 
     Handles Form1.InputLanguageChanged

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "InputLanguage", e.InputLanguage)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Culture", e.Culture)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "CharSet", e.CharSet)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"InputLanguageChanged Event")

End Sub

Remarks

This property is the Win32 character set that the user switched to. On ANSI systems, this property can be used to create fonts that can display the correct character set. On Unicode systems, you typically do not need to use this property. Instead, use the CultureInfo class for these functionalities.

Applies to