다음을 통해 공유


방법: Smartphone 입력 모드 설정

업데이트: 2007년 11월

Smartphone 응용 프로그램에서 InputMode 열거형에 정의된 대로 TextBox의 입력 모드를 ABC, T9 및 숫자 입력 모드로 설정할 수 있습니다. InputModeEditor 클래스를 사용하면 텍스트를 입력하는 Smartphone 입력 방법에 액세스할 수 있습니다.

AlphaCurrent 모드는 영문자용 텍스트 상자의 기본 입력 모드 값입니다. 이 모드는 Smartphone에서 별표(*) 키를 계속 누르면 선택되는 모드와 일치합니다.

영문자 입력 모드의 대/소문자 구분 설정을 명시적으로 변경하는 데 InputModeEditor를 사용할 수 없습니다. 그러나 사용된 영문자 입력 모드(T9 또는 ABC)는 별표 키를 사용하여 설정된 AlphaCurrent 입력 모드에 의해 유지됩니다.

InputModeEditor는 Smartphone에서 TextBox 컨트롤에만 사용할 수 있습니다.

예제

다음 코드 예제에서는 Name, Phone 및 City 텍스트 상자에서 입력 모드를 설정하는 방법을 보여 줍니다. Name 및 City 텍스트 상자는 AlphaCurrent 입력 모드를 사용하여 설정되고 Phone 텍스트 상자는 Numeric 입력 모드를 사용하여 설정됩니다.

AlphaCurrent가 실행되는 방식을 확인하려면 다음 절차를 수행합니다.

  1. Name 텍스트 상자를 선택한 상태에서 별표 키를 누른 채 T9 또는 ABC 입력 모드를 사용하여 텍스트를 입력합니다.

  2. City 텍스트 상자에 텍스트를 입력합니다. 이 때 입력 모드는 Name 텍스트 상자의 입력 모드와 같습니다.

Imports System
Imports System.Windows.Forms
Imports Microsoft.WindowsCE.Forms



Public Class Form1
   Inherits System.Windows.Forms.Form
   Private mainMenu1 As System.Windows.Forms.MainMenu
   Private mi1 As System.Windows.Forms.MenuItem

   ' Text box for name.
   Private textBox1 As System.Windows.Forms.TextBox
   ' Text box for phone number.
   Private textBox2 As System.Windows.Forms.TextBox
   ' Text box for city.
   Private textBox3 As System.Windows.Forms.TextBox

   ' Labels for name, phone, and city
   Private label1 As System.Windows.Forms.Label
   Private label2 As System.Windows.Forms.Label
   Private label3 As System.Windows.Forms.Label


   Public Sub New()

      InitializeComponent()

      ' Add a menu to close the application.
      mi1 = New MenuItem()
      mainMenu1.MenuItems.Add(mi1)
      AddHandler mi1.Click, AddressOf mi1_Click
      mi1.Text = "Done"

      ' Set input mode for name text box to AlphaCurrent.
      InputModeEditor.SetInputMode(textBox1, InputMode.AlphaCurrent)

      ' Set input mode for phone number text box to Numeric.
      InputModeEditor.SetInputMode(textBox2, InputMode.Numeric)
      ' Set input mode for city text box to AlphaCurrent.
      InputModeEditor.SetInputMode(textBox3, InputMode.AlphaCurrent)
   End Sub



   Protected Overrides Sub Dispose(disposing As Boolean)
      MyBase.Dispose(disposing)
   End Sub


   Private Sub InitializeComponent()
      Me.mainMenu1 = New System.Windows.Forms.MainMenu()

      Me.mainMenu1 = New System.Windows.Forms.MainMenu()
      Me.textBox1 = New System.Windows.Forms.TextBox()
      Me.textBox2 = New System.Windows.Forms.TextBox()
      Me.textBox3 = New System.Windows.Forms.TextBox()

      Me.label1 = New System.Windows.Forms.Label()
      Me.label2 = New System.Windows.Forms.Label()
      Me.label3 = New System.Windows.Forms.Label()
      '
      ' textBox1
      '
      Me.textBox1.Location = New System.Drawing.Point(64, 8)
      Me.textBox1.Size = New System.Drawing.Size(104, 25)
      Me.textBox1.Text = ""
      '
      ' textBox2
      '
      Me.textBox2.Location = New System.Drawing.Point(64, 40)
      Me.textBox2.Size = New System.Drawing.Size(104, 25)
      Me.textBox2.Text = ""
      '
      ' textBox3
      '
      Me.textBox3.Location = New System.Drawing.Point(64, 72)
      Me.textBox3.Size = New System.Drawing.Size(104, 25)
      Me.textBox3.Text = ""
      '
      ' label1
      '
      Me.label1.Location = New System.Drawing.Point(8, 8)
      Me.label1.Size = New System.Drawing.Size(56, 22)
      Me.label1.Text = "Name"
      '
      ' label2
      '
      Me.label2.Location = New System.Drawing.Point(8, 40)
      Me.label2.Size = New System.Drawing.Size(56, 22)
      Me.label2.Text = "Phone"
      '
      ' label3
      '
      Me.label3.Location = New System.Drawing.Point(8, 72)
      Me.label3.Size = New System.Drawing.Size(56, 22)
      Me.label3.Text = "City"
      '
      ' Form1
      '
      Me.Controls.Add(textBox1)
      Me.Controls.Add(textBox2)
      Me.Controls.Add(textBox3)
      Me.Controls.Add(label1)
      Me.Controls.Add(label2)
      Me.Controls.Add(label3)
      Me.Menu = Me.mainMenu1
      Me.Text = "Input Mode Demo"
   End Sub


   Shared Sub Main()
      Application.Run(New Form1())
   End Sub


   Private Sub mi1_Click(sender As Object, e As EventArgs)
      Me.Close()
   End Sub
End Class
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using Microsoft.WindowsCE.Forms;

public class Form1 : System.Windows.Forms.Form
{
 private System.Windows.Forms.MainMenu mainMenu1;
 private System.Windows.Forms.MenuItem mi1;

 // Text box for name.
 private System.Windows.Forms.TextBox textBox1;
 // Text box for phone number.
 private System.Windows.Forms.TextBox textBox2;
 // Text box for city.
 private System.Windows.Forms.TextBox textBox3;

 // Labels for name, phone, and city
 private System.Windows.Forms.Label label1;
 private System.Windows.Forms.Label label2;
 private System.Windows.Forms.Label label3;

 public Form1()
 {

  InitializeComponent();

  // Add a menu to close the application.
  mi1 = new MenuItem();
  mainMenu1.MenuItems.Add(mi1);
  mi1.Click +=new EventHandler(mi1_Click);
  mi1.Text = "Done";

  // Set input mode for name text box to AlphaCurrent.
  InputModeEditor.SetInputMode(textBox1, InputMode.AlphaCurrent);

  // Set input mode for phone number text box to Numeric.
  InputModeEditor.SetInputMode(textBox2, InputMode.Numeric);

  // Set input mode for city text box to AlphaCurrent.
  InputModeEditor.SetInputMode(textBox3, InputMode.AlphaCurrent);


 }

 protected override void Dispose( bool disposing )
 {
  base.Dispose( disposing );
 }

 private void InitializeComponent()
 {
  this.mainMenu1 = new System.Windows.Forms.MainMenu();

  this.mainMenu1 = new System.Windows.Forms.MainMenu();
  this.textBox1 = new System.Windows.Forms.TextBox();
  this.textBox2 = new System.Windows.Forms.TextBox();
  this.textBox3 = new System.Windows.Forms.TextBox();

  this.label1 = new System.Windows.Forms.Label();
  this.label2 = new System.Windows.Forms.Label();
  this.label3 = new System.Windows.Forms.Label();
  //
  // textBox1
  //
  this.textBox1.Location = new System.Drawing.Point(64, 8);
  this.textBox1.Size = new System.Drawing.Size(104, 25);
  this.textBox1.Text = "";
  //
  // textBox2
  //
  this.textBox2.Location = new System.Drawing.Point(64, 40);
  this.textBox2.Size = new System.Drawing.Size(104, 25);
  this.textBox2.Text = "";
  //
  // textBox3
  //
  this.textBox3.Location = new System.Drawing.Point(64, 72);
  this.textBox3.Size = new System.Drawing.Size(104, 25);
  this.textBox3.Text = "";
  //
  // label1
  //
  this.label1.Location = new System.Drawing.Point(8, 8);
  this.label1.Size = new System.Drawing.Size(56, 22);
  this.label1.Text = "Name";
  //
  // label2
  //
  this.label2.Location = new System.Drawing.Point(8, 40);
  this.label2.Size = new System.Drawing.Size(56, 22);
  this.label2.Text = "Phone";
  //
  // label3
  //
  this.label3.Location = new System.Drawing.Point(8, 72);
  this.label3.Size = new System.Drawing.Size(56, 22);
  this.label3.Text = "City";
  //
  // Form1
  //
  this.Controls.Add(this.textBox1);
  this.Controls.Add(this.textBox2);
  this.Controls.Add(this.textBox3);
  this.Controls.Add(this.label1);
  this.Controls.Add(this.label2);
  this.Controls.Add(this.label3);
  this.Menu = this.mainMenu1;
  this.Text = "Input Mode Demo";

 }

 static void Main()
 {
  Application.Run(new Form1());
 }

 private void mi1_Click(object sender, EventArgs e)
 {
  this.Close();
 }
}

코드 컴파일

이 예제에는 다음과 같은 네임스페이스에 대한 참조가 필요합니다.

참고 항목

기타 리소스

Smartphone 개발 및 .NET Compact Framework