InputPanel.InputMethodCollection Class
Provides access to all input method software installed on a Pocket PC. This class cannot be inherited.
Assembly: Microsoft.WindowsCE.Forms (in Microsoft.WindowsCE.Forms.dll)
This collection accesses the methods for text and character entry in the soft input panel (SIP) on a Pocket PC. Common input methods include:
Keyboard
Tap characters on the SIP keyboard or on a hardware keyboard attachment.
Letter Recognizer
Draw letters and numbers in the SIP. When the user pauses, the writing is automatically converted to typed text and displayed at the insertion point.
Block Recognizer
Draw predetermined strokes in the SIP that render as specific characters. This input method is similar to graffiti emulation.
Other input methods can be installed to support languages such as Japanese and Russian. When a new input method is installed on the device, it is included in the input method collection.
Use the InputMethods property to get an InputPanel.InputMethodCollection.
The following code example enumerates InputPanel.InputMethodCollection and lists the available input methods in a list box. When a user selects an input method, the CurrentInputMethod property is set to that input method. The Enabled property for the input panel is set to true so that the keyboard and other input areas are displayed for the user.
Imports System Imports System.Windows.Forms Imports Microsoft.WindowsCE.Forms Imports Microsoft.VisualBasic Public Class Form1 Inherits System.Windows.Forms.Form Private WithEvents ListBox1 As System.Windows.Forms.ListBox Private TextBox1 As System.Windows.Forms.TextBox Private InputPanel1 As Microsoft.WindowsCE.Forms.InputPanel Public Sub New() InitializeComponent() 'Display OK Button for closing the application. Me.MinimizeBox = False MessageBox.Show(InputPanel1.InputMethods.Count.ToString()) ' Display the input panel. InputPanel1.Enabled = True ' Get the input methods to populate the list box. ' Select the first method. GetInputMethods() ListBox1.SelectedIndex = 0 ' Set the focus on the text box to render input from the input panel. TextBox1.Focus() End Sub Protected Overrides Sub Dispose(disposing As Boolean) MyBase.Dispose(disposing) End Sub Private Sub InitializeComponent() Me.InputPanel1 = New Microsoft.WindowsCE.Forms.InputPanel Me.ListBox1 = New System.Windows.Forms.ListBox Me.TextBox1 = New System.Windows.Forms.TextBox ' ' ListBox1 ' Me.ListBox1.Location = New System.Drawing.Point(8, 40) Me.ListBox1.Size = New System.Drawing.Size(200, 80) ' ' TextBox1 ' Me.TextBox1.Location = New System.Drawing.Point(8, 140) Me.TextBox1.Size = New System.Drawing.Size(200, 200) ' ' Form1 ' Me.Controls.Add(ListBox1) Me.Controls.Add(TextBox1) Me.Text = "Input Methods" End Sub Shared Sub Main() Application.Run(New Form1()) End Sub Private Sub GetInputMethods() Me.ListBox1.Items.Clear() ' Get the InputMethods collection and ' add each method to the list box. Dim im As InputMethod For Each im In InputPanel1.InputMethods Me.ListBox1.Items.Add(im.Name) Next im End Sub ' This event handler iterates through the ' InputMethodCollection and sets the input method ' to the input method selected in the list box. ' When a member of the collection is the ' same the selected value in the list box, that ' method is set to the current input method. Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged ' Get the selected input method from the list box. Dim strIM As String strIM = ListBox1.SelectedItem.ToString() ' Iterate through the input method collection. ' When there is a match with the input method ' selected in the list box, set the ' CurrentInputMethod property to the selected method. Dim im As InputMethod For Each im In InputPanel1.InputMethods If im.Name = strIM Then ' Change the input method. InputPanel1.CurrentInputMethod = im End If Next im End Sub End Class ' Note that the InputMethodCollection ' can also be enumerated as follows: ' InputPanel.InputMethodCollection imc; ' imc = InputPanel1.InputMethods; ' for (int i = 0; i < imc.Count; i++) ' { ' if (imc[i].Name == strIM) ' { ' // Change input method. ' InputPanel1.CurrentInputMethod = imc[i]; ' ' break; ' } ' }
Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.