共用方式為


PenInputPanel.PanelChanged 事件

已取代。在 PenInputPanel 物件變更目前用來輸入的面板類型時發生。PenInputPanel 已被 Microsoft.Ink.TextInput 取代。

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

語法

'宣告
Public Event PanelChanged As PenInputPanelChangedEventHandler
'用途
Dim instance As PenInputPanel
Dim handler As PenInputPanelChangedEventHandler

AddHandler instance.PanelChanged, handler
public event PenInputPanelChangedEventHandler PanelChanged
public:
 event PenInputPanelChangedEventHandler^ PanelChanged {
    void add (PenInputPanelChangedEventHandler^ value);
    void remove (PenInputPanelChangedEventHandler^ value);
}
/** @event */
public void add_PanelChanged (PenInputPanelChangedEventHandler value)
/** @event */
public void remove_PanelChanged (PenInputPanelChangedEventHandler value)
JScript 不支援事件。

備註

事件處理常式會收到 PenInputPanelChangedEventArgs 型別的引數,其中包含這個事件的相關資料。

建立 PenInputPanel 物件時,[手寫] 面板是預設的面板類型。如果面板在「畫筆輸入面板」初次變成作用中之前,就因設定 CurrentPanel 屬性而變更,則會發生 PanelChanged 事件。

使用者在用於多重字元輸入 (例如單字) 的 PanelType 面板以及用於單一字元輸入的 PanelType 面板之間切換時,不會引發 PanelChanged 事件。

ms567741.alert_security(zh-tw,VS.90).gif安全性注意事項:

如果在部分信任的情況下使用,除了 PenInputPanel 所需的權限之外,這個事件還需要 SecurityPermissionFlag.AllFlags (英文) 權限。如需詳細資訊,請參閱Security and Trust

範例

這個 C# 範例會建立 PenInputPanel 物件 thePenInputPanel,並且將它附加至 InkEdit 控制項 theInkEdit。然後會將 PanelChanged 事件處理常式加入至 thePenInputPanel。PanelChanged 處理常式會將所附加 InkEdit 控制項的文字設定為包含新面板型別的句子。

[C#]

//...

// Delcare 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 PanelChanged event handler
    thePenInputPanel.PanelChanged +=
        new PenInputPanelChangedEventHandler(PanelChanged_Event);
}

//...

public void PanelChanged_Event(object sender,
 PenInputPanelChangedEventArgs e)
{
    // Make sure the object that generated
    // the event is a PenInputPanel object
    if (sender is PenInputPanel)
    {
        PenInputPanel theSenderPanel = (PenInputPanel)sender;

        theSenderPanel.AttachedEditControl.Text = "The panel has changed to ";
        theSenderPanel.AttachedEditControl.Text += e.NewPanelType.ToString();
    }
}

這個 Microsoft® Visual Basic® .NET 範例會建立 PenInputPanel 物件 thePenInputPanel,並且將它附加至 InkEdit 控制項 theInkEdit。然後會將 PanelChanged 事件處理常式加入至 thePenInputPanel。PanelChanged 處理常式會將所附加 InkEdit 控制項的文字設定為包含新面板型別的句子。

[Visual Basic]

'...

' Declare the PenInputPanel object
Dim thePenInputPanel As PenInputPanel

Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    ' Create and attach the new PenInputPanel to an InkEdit control.
    thePenInputPanel = New PenInputPanel(theInkEdit)

   ' Add a PanelChanged event handler
   AddHandler thePenInputPanel.PanelChanged, AddressOf PanelChanged_Event
End Sub 'New

'...

Public Sub PanelChanged_Event(ByVal sender As Object, ByVal e As _
                              PenInputPanelChangedEventArgs)
    ' 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)

        theSenderPanel.AttachedEditControl.Text = "The panel has changed to "
        theSenderPanel.AttachedEditControl.Text += e.NewPanelType.ToString
    End If
End Sub 'PanelChanged_Event

平台

Windows Vista

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

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

PenInputPanel 類別

PenInputPanel 成員

Microsoft.Ink 命名空間

PanelType

PenInputPanel.OnPanelChanged