Share via


PenInputPanelInputFailedEventHandler (Delegado)

Actualización: noviembre 2007

Representa el método que controla el evento InputFailed de un objeto PenInputPanel.

Espacio de nombres:  Microsoft.Ink
Ensamblado:  Microsoft.Ink (en Microsoft.Ink.dll)

Sintaxis

'Declaración
Public Delegate Sub PenInputPanelInputFailedEventHandler ( _
    sender As Object, _
    e As PenInputPanelInputFailedEventArgs _
)
'Uso
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 no admite delegados.

Parámetros

Comentarios

El evento InputFailed se produce cuando el foco de entrada cambia antes de que los datos proporcionados por el usuario se inserten en el control asociado. Por ejemplo, este evento se desencadena si el usuario escribe entrada manuscrita en el panel de escritura y, a continuación, puntea otro control de edición antes de que el reconocedor haya tenido tiempo de finalizar.

Si usa el identificador de ventana pasado en este evento, puede elegir insertar el texto usted mismo cuando este evento se produce.

Ejemplos

En este ejemplo de C# se crean dos objetos PenInputPanel, thePenInputPanel1 y thePenInputPanel2, y se asocian a los controles TextBoxtextBox1 y textBox2. Agrega un controlador de eventos InputFailed, InputFailed_Event, a cada objeto PenInputPanel. En el controlador de eventos, si se modifica el foco, el texto se establece en el control TextBox al establecer su propiedad 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;
    }
}

En este ejemplo de Microsoft® Visual Basic® .NET se crean dos objetos PenInputPanelthePenInputPanel1 y thePenInputPanel2, y se asocian a los controles TextBoxTextBox1 y TextBox2. Agrega un controlador de eventos InputFailed, InputFailed_Event, a cada objeto PenInputPanel. En el controlador de eventos, si se modifica el foco, el texto se establece en el control TextBox al establecer su propiedad 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

Plataformas

Windows Vista

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Información de versión

.NET Framework

Compatible con: 3.0

Vea también

Referencia

Microsoft.Ink (Espacio de nombres)

PenInputPanel.OnInputFailed