PenInputPanelInputFailedEventHandler 委托

表示处理 PenInputPanel 对象的 InputFailed 事件的方法。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
Public Delegate Sub PenInputPanelInputFailedEventHandler ( _
    sender As Object, _
    e As PenInputPanelInputFailedEventArgs _
)
用法
Dim instance As New PenInputPanelInputFailedEventHandler(AddressOf HandlerMethod)
public delegate void PenInputPanelInputFailedEventHandler(
    Object sender,
    PenInputPanelInputFailedEventArgs e
)
public delegate void PenInputPanelInputFailedEventHandler(
    Object^ sender, 
    PenInputPanelInputFailedEventArgs^ e
)
/** @delegate */
public delegate void PenInputPanelInputFailedEventHandler(
    Object sender,
    PenInputPanelInputFailedEventArgs e
)
JScript 不支持委托。

参数

备注

如果在尚未将用户输入插入附加的控件时输入焦点发生更改,则会发生 InputFailed 事件。例如,如果用户将墨迹 输入到书写板中,然后在识别器来不及完成操作之前点击另一个编辑控件,则会激发该事件。

通过使用传入该事件的窗口句柄,您可以选择在发生该事件时自己插入文本。

示例

此 C# 示例创建两个 PenInputPanel 对象(thePenInputPanel1 和 thePenInputPanel2),并将它们附加到 TextBox 控件(textBox1 和 textBox2)。此示例将 InputFailed 事件处理程序 InputFailed_Event 添加到每个 PenInputPanel。在事件处理程序中,如果焦点已经更改,则通过设置前一个 TextBox 控件的 Text 属性来设置文本。

[C#]

//...

// Declare PenInputPanel objects
PenInputPanel thePenInputPanel1;
PenInputPanel thePenInputPanel2;

public Form1()
{
    // Required for Windows Form Designer support
    InitializeComponent();

    // Create, and attach new PenInputPanels to a TextBox controls.
    thePenInputPanel1 = new PenInputPanel(textBox1);
    thePenInputPanel2 = new PenInputPanel(textBox2);

    // Add an InputFailed event handler to each PenInputPanel
    thePenInputPanel1.InputFailed +=
        new PenInputPanelInputFailedEventHandler(InputFailed_Event);

    thePenInputPanel2.InputFailed +=
        new PenInputPanelInputFailedEventHandler(InputFailed_Event);
}

//...

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

        // Set the text in the previous control
        theSenderPanel.AttachedEditControl.Text += e.Text;
    }
}

此 Microsoft(R) Visual Basic(R) .NET 示例创建两个 PenInputPanel 对象(thePenInputPanel1 和 thePenInputPanel2),并将它们附加到 TextBox 控件(TextBox1 和 TextBox2)。此示例将 InputFailed 事件处理程序 InputFailed_Event 添加到每个 PenInputPanel。在事件处理程序中,如果焦点已经更改,则通过设置前一个 TextBox 控件的 Text 属性来设置文本。

[Visual Basic]

'...

' Declare the PenInputPanel objects
Dim thePenInputPanel1 As PenInputPanel
Dim thePenInputPanel2 As PenInputPanel

Public Sub New()
    MyBase.New()

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

    ' Create and attach new PenInputPanels to a TextBox controls.
    thePenInputPanel1 = New PenInputPanel(TextBox1)
    thePenInputPanel2 = New PenInputPanel(TextBox2)

    ' Add an InputFailed event handler to each PenInputPanel
    AddHandler thePenInputPanel1.InputFailed, AddressOf InputFailed_Event
    AddHandler thePenInputPanel2.InputFailed, AddressOf InputFailed_Event
End Sub 'New

'...

Public Sub InputFailed_Event(ByVal sender As Object, ByVal e As _
                             PenInputPanelInputFailedEventArgs)
    ' Make sure the object that generated
    ' the event is a PenInputPanel object
    If TypeOf sender Is PenInputPanel Then
        Dim thePenInputPanel As PenInputPanel = CType(sender, PenInputPanel)

        ' Set the text in the previous control
        thePenInputPanel.AttachedEditControl.Text += e.Text
    End If
End Sub 'InputFailed_Event

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

Microsoft.Ink 命名空间

PenInputPanel.OnInputFailed