HOW TO:使用 InputPanel 元件

更新:2007 年 11 月

InputPanel 元件會提供 Pocket PC 上螢幕小鍵盤 (SIP) 的程式設計控制項。啟用及停用 SIP 時,通常都是為了重新調整表單上控制項的位置或大小,而撰寫 SIP 程式。

注意事項:

在 .NET Compact Framework 1.0 版中,必須有 MainMenu 元件才能使用 InputPanel 元件。

您也可以對安裝在 Pocket PC 上的所有輸入法,指定此輸入法。如需設定輸入法的範例,請參閱 HOW TO:設定 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);

編譯程式碼

這些範例需要下列命名空間的參考:

請參閱

工作

HOW TO:設定 Pocket PC 輸入法

概念

InputPanel 元件

參考

InputPanel