PenInputPanel.CurrentPanel 屬性
已取代。取得或設定 PenInputPanel 物件內目前用來輸入的面板類型。PenInputPanel 已被 Microsoft.Ink.TextInput 取代。
命名空間: Microsoft.Ink
組件: Microsoft.Ink (在 Microsoft.Ink.dll 中)
語法
'宣告
Public Property CurrentPanel As PanelType
'用途
Dim instance As PenInputPanel
Dim value As PanelType
value = instance.CurrentPanel
instance.CurrentPanel = value
public PanelType CurrentPanel { get; set; }
public:
property PanelType CurrentPanel {
PanelType get ();
void set (PanelType value);
}
/** @property */
public PanelType get_CurrentPanel()
/** @property */
public void set_CurrentPanel(PanelType value)
public function get CurrentPanel () : PanelType
public function set CurrentPanel (value : PanelType)
屬性值
型別:Microsoft.Ink.PanelType
其中一個 PanelType 值,表示 PenInputPanel 物件內目前用來輸入的面板類型。Handwriting 面板類型為預設值。
備註
注意事項: |
---|
當您建立 PenInputPanel 物件時,Handwriting 面板 (也稱為書寫板) 是預設的輸入 UI。
如果您在 PenInputPanel 物件初次變成作用中之前,透過設定 CurrentPanel 屬性變更面板,則會發生 PanelChanged 事件。
CurrentPanel 屬性只能設定為 PanelType 列舉型別的 Handwriting 或 Keyboard 值。CurrentPanel 屬性永遠無法設定為 Default 或 Inactive。
如果面板視窗與 PenInputPanel 物件的其他執行個體相關聯,則 CurrentPanel 屬性會傳回 Inactive 列舉值。如果面板非現用或是面板類型無效,則設定 CurrentPanel 屬性會引發例外狀況。
安全性注意事項: |
---|
如果在部分信任的情況下使用,除了 PenInputPanel 所需的權限之外,這個屬性還需要 SecurityPermissionFlag.AllFlags (英文) 權限。如需詳細資訊,請參閱Security and Trust。 |
範例
這個 C# 範例會建立 PenInputPanel 物件 thePenInputPanel,並且將它附加至 InkEdit 控制項 theInkEdit。它會將 VisibleChanged 事件處理常式 VisibleChanged_Event 附加至 thePenInputPanel。事件處理常式會透過將 CurrentPanel 屬性設為 [鍵盤] 的方式,強制畫筆輸入面板在可見時顯示鍵盤面板。
[C#]
//...
// Declare the PenInputPanel object
PenInputPanel thePenInputPanel;
public Form1()
{
// Required for Windows Form Designer support
InitializeComponent();
// Create and attach the new PenInputPanel to an InkEdit control.
thePenInputPanel = new PenInputPanel(theInkEdit);
// Add a VisibleChanged event handler
thePenInputPanel.VisibleChanged +=
new PenInputPanelVisibleChangedEventHandler(VisibleChanged_Event);
}
//...
public void VisibleChanged_Event(object sender,
PenInputPanelVisibleChangedEventArgs e)
{
// Make sure the object that generated
// the event is a PenInputPanel object
if (sender is PenInputPanel)
{
PenInputPanel theSenderPanel = (PenInputPanel)sender;
// If the panel has become visible...
if (e.NewVisibility)
{
// Always default to keyboard input
if (theSenderPanel.CurrentPanel == PanelType.Handwriting)
{
theSenderPanel.CurrentPanel = PanelType.Keyboard;
}
}
}
}
這個 Microsoft® Visual Basic® .NET 範例會建立 PenInputPanel 物件 thePenInputPanel,並且將它附加至 InkEdit 控制項 theInkEdit。它會將 VisibleChanged 事件處理常式 VisibleChanged_Event 附加至 thePenInputPanel。事件處理常式會透過將 CurrentPanel 屬性設為 [鍵盤] 的方式,強制畫筆輸入面板在可見時顯示鍵盤面板。
[Visual Basic]
'...
' Declare the PenInputPanel object
Dim thePenInputPanel As PenInputPanel
Public Sub New()
MyBase.New()
' Required for Windows Form Designer support
InitializeComponent()
' Create and attach the new PenInputPanel to an InkEdit control.
thePenInputPanel = New PenInputPanel(theInkEdit)
' Add a VisibleChanged event handler
AddHandler thePenInputPanel.VisibleChanged, _
AddressOf VisibleChanged_Event
End Sub 'New
'...
Public Sub VisibleChanged_Event(sender As Object, e As _
PenInputPanelVisibleChangedEventArgs)
' Make sure the object that generated
' the event is a PenInputPanel object
If TypeOf sender Is PenInputPanel Then
Dim theSenderPanel As PenInputPanel = CType(sender, PenInputPanel)
' If the panel has become visible...
If e.NewVisibility Then
' Always default to keyboard input
If theSenderPanel.CurrentPanel = PanelType.Handwriting Then
theSenderPanel.CurrentPanel = PanelType.Keyboard
End If
End If
End If
End Sub 'VisibleChanged_Event
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0