I'm trying to duplicate the following behavior (WM6).
我正在尝试复制以下行为(WM6)。
Go to Settings -> About -> Device ID. The Device Name textbox gets the focus, causing the onscreen keyboard to pop up.
转到设置 - >关于 - >设备ID。设备名称文本框获得焦点,导致屏幕键盘弹出。
I'd like to be able to do the same in my application, preferably in managed code.
我希望能够在我的应用程序中执行相同的操作,最好是在托管代码中。
2 个解决方案
#1
The onscreen keyboard is in the Microsoft.WindowsCE.Forms namespace.
屏幕键盘位于Microsoft.WindowsCE.Forms命名空间中。
Add a project reference to that and you'll have the InputPanel control available, add one of those to your form then in your code behind.
添加一个项目引用,你可以使用InputPanel控件,然后在你的代码后面添加其中一个。
private void txtField_GotFocus(object sender, EventArgs e)
{
//Enabled == show
inputPanel.Enabled = true;
}
private void txtField_LostFocus(object sender, EventArgs e)
{
inputPanel.Enabled = false;
}
#2
I would add that you also need to instantiate an instance of the Microsoft.WindowsCE.Forms.InputPanel class for your project (in addtion to adding a reference to the namespace as noted by TreeUK).
我想补充一点,你还需要为你的项目实例化一个Microsoft.WindowsCE.Forms.InputPanel类的实例(除了添加对TreeUK所指的命名空间的引用)。
The easiest way to do this is to drag an InputPanel control onto your Windows Form in Design mode. Whatever you name your InputPanel instance would be what you reference in the event handlers for your form fields.
最简单的方法是在设计模式下将InputPanel控件拖到Windows窗体上。无论您的名称是什么,您的InputPanel实例都将是您在表单字段的事件处理程序中引用的内容。
#1
The onscreen keyboard is in the Microsoft.WindowsCE.Forms namespace.
屏幕键盘位于Microsoft.WindowsCE.Forms命名空间中。
Add a project reference to that and you'll have the InputPanel control available, add one of those to your form then in your code behind.
添加一个项目引用,你可以使用InputPanel控件,然后在你的代码后面添加其中一个。
private void txtField_GotFocus(object sender, EventArgs e)
{
//Enabled == show
inputPanel.Enabled = true;
}
private void txtField_LostFocus(object sender, EventArgs e)
{
inputPanel.Enabled = false;
}
#2
I would add that you also need to instantiate an instance of the Microsoft.WindowsCE.Forms.InputPanel class for your project (in addtion to adding a reference to the namespace as noted by TreeUK).
我想补充一点,你还需要为你的项目实例化一个Microsoft.WindowsCE.Forms.InputPanel类的实例(除了添加对TreeUK所指的命名空间的引用)。
The easiest way to do this is to drag an InputPanel control onto your Windows Form in Design mode. Whatever you name your InputPanel instance would be what you reference in the event handlers for your form fields.
最简单的方法是在设计模式下将InputPanel控件拖到Windows窗体上。无论您的名称是什么,您的InputPanel实例都将是您在表单字段的事件处理程序中引用的内容。