共用方式為


InputPanel 類別

控制螢幕輸入面板 (SIP),以便在 Pocket PC 及其他 Windows Embedded CE 架構的裝置上輸入資料。 

命名空間:  Microsoft.WindowsCE.Forms
組件:  Microsoft.WindowsCE.Forms (在 Microsoft.WindowsCE.Forms.dll 中)

語法

'宣告
Public Class InputPanel _
    Inherits Component
'用途
Dim instance As InputPanel
public class InputPanel : Component
public ref class InputPanel : public Component
public class InputPanel extends Component

備註

.NET Compact Framework 提供 InputPanel 元件,此元件可為 Windows Embedded CE 中的 SIP 控制項提供 Managed 實作方式。當您針對 Pocket PC 平台建立 Windows 架構應用程式時,Visual Studio 會自動將 MainMenu 元件加入至專案中的 Form1 檔。這個元件會在表單上加入內含 SIP 圖示的下方功能表列。不需要程式設計的方式也能夠使用 SIP;使用者可以點選 SIP 圖示以切換 SIP 的顯示。若要為 SIP 撰寫程式,請將 InputPanel 元件從 ToolBox 拖曳至表單。

透過程式設計方式,您可以使用 Enabled 屬性來顯示 SIP、利用 Bounds 屬性來取得其大小,並以 VisibleDesktop 屬性來判斷未遭 SIP 所佔用的表單區域大小。請注意,Bounds 屬性在 Pocket PC 上永遠都會傳回 240 像素的寬度以及 80 像素的高度 (不論是否啟用 SIP)。每當透過使用者或以程式設計方式啟用或停用 SIP 時,即會發生 EnabledChanged 事件。當啟用及停用 SIP 時,為 SIP 撰寫程式的一般性理由為重新調整表單上控制項的位置或大小。

Topic Location
HOW TO:使用 InputPanel 元件 .NET Compact Framework
HOW TO:使用 InputPanel 元件 .NET Compact Framework
HOW TO:使用 InputPanel 元件 .NET Compact Framework

範例

下列範例包含索引標籤控制項頁面上的文字方塊。當此文字方塊接收焦點時會顯示 SIP,並使用 EnabledChanged 事件,以便在啟用 SIP 時降低索引標籤控制項的高度,並在停用 SIP 時還原成原始高度。

注意事項:

您必須在專案中加入 Microsoft.WindowsCE.Forms 命名空間的參考,才能建置這個範例。

Private Sub TextBox1_GotFocus(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles TextBox1.GotFocus
 ' Display the SIP.
 ' Note that the EnabledChanged event occurs
 ' whenever the SIP is enabled or disabled.
 InputPanel1.Enabled = True
End Sub
Private Sub InputPanel1_EnabledChanged(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles InputPanel1.EnabledChanged
 If InputPanel1.Enabled = False Then

  ' The SIP is disabled, so set the height of the tab control
  ' to its original height with a variable (TabOriginalHeight),
  ' which is determined during initialization of the form.
  VisibleRect = InputPanel1.VisibleDesktop
  TabControl1.Height = TabOriginalHeight
 Else
  ' The SIP is enabled, so the height of the tab control
  ' is set to the height of the visible desktop area.
  VisibleRect = InputPanel1.VisibleDesktop
  TabControl1.Height = VisibleRect.Height
 End If

 ' The Bounds property always returns a width of 240 and a height of 80
 ' pixels for Pocket PCs, regardless of whether or not the SIP is enabled.
 BoundsRect = InputPanel1.Bounds

 ' Show the VisibleDesktop and Bounds values
 ' on the second tab for demonstration purposes.
       VisibleInfo.Text = String.Format("VisibleDesktop: X = {0}, " _
       & "Y = {1}, Width = {2}, Height = {3}", _
       VisibleRect.X, VisibleRect.Y, _
       VisibleRect.Width, VisibleRect.Height)
       BoundsInfo.Text = String.Format("Bounds: X = {0}, Y = {1}," _
          & "Width = {2}, Height = {3}", BoundsRect.X, BoundsRect.Y, _
          BoundsRect.Width, BoundsRect.Height)
End Sub
private void textBox1_GotFocus(object sender, System.EventArgs e)
{
    // Display the SIP.
    // Note that the EnabledChanged event occurs
    // whenever the SIP is enabled or disabled.
    inputPanel1.Enabled = true;

}
private void inputPanel1_EnabledChanged(object sender, EventArgs e)
{
    if (inputPanel1.Enabled == false)
    {
        // The SIP is disabled, so set the height of the tab control
        // to its original height with a variable (TabOriginalHeight),
        // which is determined during initialization of the form.
        VisibleRect = inputPanel1.VisibleDesktop;
        tabControl1.Height = TabOriginalHeight;
    }
    else
    {
        // The SIP is enabled, so the height of the tab control
        // is set to the height of the visible desktop area.
        VisibleRect = inputPanel1.VisibleDesktop;
        tabControl1.Height = VisibleRect.Height;
    }

    // The Bounds property always returns a width of 240 and a height of 80
    // pixels for Pocket PCs, regardless of whether or not the SIP is enabled.
    BoundsRect = inputPanel1.Bounds;

    // Show the VisibleDestkop and Bounds values
    // on the second tab for demonstration purposes.
    VisibleInfo.Text = String.Format("VisibleDesktop: X = {0}, " +
        "Y = {1}, Width = {2}, Height = {3}", VisibleRect.X,
        VisibleRect.Y, VisibleRect.Width, VisibleRect.Height);
    BoundsInfo.Text = String.Format("Bounds: X = {0}, Y = {1}, " +
        "Width = {2}, Height = {3}", BoundsRect.X, BoundsRect.Y,
        BoundsRect.Width, BoundsRect.Height);
}

繼承階層架構

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      Microsoft.WindowsCE.Forms.InputPanel

執行緒安全

這個型別的任何 Public static (在 Visual Basic 中為 Shared) 成員都具備執行緒安全。並非所有的執行個體成員都是安全執行緒。

平台

Windows CE, Windows Mobile for Pocket PC

.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求

版本資訊

.NET Compact Framework

支援版本:3.5、2.0、1.0

請參閱

參考

InputPanel 成員

Microsoft.WindowsCE.Forms 命名空間