如何:使用 InputPanel 组件

更新:2007 年 11 月

InputPanel 组件在 Pocket PC 上提供对软输入面板 (SIP) 的编程控制。需要对 SIP 进行编程的一个典型原因是:当启用和禁用 SIP 时要在窗体上重新调整控件的位置或大小。

说明:

需要 MainMenu 组件才能在 .NET Compact Framework 1.0 版中使用 InputPanel 组件。

还可以为安装在 Pocket PC 上的所有输入法指定输入法。有关设置输入法的示例,请参见如何:设置 Pocket PC 输入方法

示例

下面的代码示例演示如何调整一个 TabControl 的大小以适应 SIP。

窗体上包含以下控件:

当文本框接收焦点时,启用 SIP 以便输入文本。当用户启用或禁用 SIP 时,引发 EnabledChanged 事件。此事件的事件处理程序执行下面的操作:

  • 如果启用了 SIP,则降低选项卡控件的高度以便 SIP 不会遮住该控件。

  • 如果禁用了 SIP,则将选项卡控件的高度设置为原始高度(该高度在初始化窗体时存储在一个变量中)。

'Get the original height of the tab control.
TabOriginalHeight = TabControl1.Height

' Get the deminsions of the visible 
' desktop area when the SIP is not displayed.
VisibleRect = InputPanel1.VisibleDesktop
// Get the original height of the tab control.
TabOriginalHeight = tabControl1.Height;

// Get the deminsions of the visible 
// desktop area when the SIP is not displayed.
VisibleRect = inputPanel1.VisibleDesktop;


inputPanel1.EnabledChanged += new EventHandler(inputPanel1_EnabledChanged);

// Add a delegate for GotFocus event to the TextBox
// by creating an instance of EventHandler that takes
// a reference to TextBox1_GotFocus in its argument.
this.textBox1.GotFocus += new System.EventHandler(this.textBox1_GotFocus);

编译代码

此示例需要引用下面的命名空间:

请参见

任务

如何:设置 Pocket PC 输入方法

概念

InputPanel 组件

参考

InputPanel