InputPanel.EnabledChanged 事件
在啟用或停用螢幕小鍵盤 (SIP) 時發生。
命名空間: Microsoft.WindowsCE.Forms
組件: Microsoft.WindowsCE.Forms (在 Microsoft.WindowsCE.Forms.dll 中)
語法
'宣告
Public Event EnabledChanged As EventHandler
'用途
Dim instance As InputPanel
Dim handler As EventHandler
AddHandler instance.EnabledChanged, handler
public event EventHandler EnabledChanged
public:
event EventHandler^ EnabledChanged {
void add (EventHandler^ value);
void remove (EventHandler^ value);
}
JScript 不支援事件。
備註
每當以程式設計方式或由使用者啟用或停用 SIP 時,即會發生 EnabledChanged 事件。發生這個事件時,您可以判斷 SIP 是啟用還是停用,並適當重新調整控制項的位置或大小。
您可以變更 Enabled 屬性,引發這個事件。
範例
下列範例會在 SIP 為啟用時使用 EnabledChanged 事件,以降低索引標籤控制項的高度。停用 SIP 時,它會將索引標籤控制項恢復為原始的高度。這個範例是 InputPanel 元件完整範例的一部分。
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 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);
}
使用權限
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
平台
Windows CE, Windows Mobile for Pocket PC
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Compact Framework
支援版本:3.5、2.0、1.0