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-cn,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(R) Visual Basic(R) .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