您的位置:首页 > 其它

Windows Mobile 设定TextBox的输入法状态

2009-11-30 14:11 148 查看
1.问题描述

在 Windows Forms 应用程序中,可通过TextBox.ImeMode 属性设置输入状态,如下图所示。

在智能设备应用中,如何设定TextBox的输入法状态呢?







2.方法

在智能设备应用中需通过InputModeEditor.SetInputMode方法:指定Smartphone上的输入模式。

使用前,必须先添加Microsoft.WindowCE.Forms引用,位置在:C:/Program Files/Microsoft Visual Studio 9.0/Common7/IDE/PrivateAssemblies







接着引入命名空间

using Microsoft.WindowsCE.Forms;

以下程序将TextBox 指定输入模式为InputMode.Numeric(只接受数字资源与符号)

using System;

using System.Linq;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using Microsoft.WindowsCE.Forms;

namespace SmartDeviceProject2

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

// 指定 Smartphone 上的输入模式为 InputMode.Numeric (只接受数字资源与符号)

InputModeEditor.SetInputMode(textBox1, InputMode.Numeric);

}

}

}



可设定的InputMode输入模式请参考InputMode列举类型

参考:

http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesvbcs/thread/d889d8e6-0be3-4769-95b8-524b937346d5
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: