Freigeben über


PenInputPanel.CommitPendingInput Method

PenInputPanel.CommitPendingInput Method

Sends collected ink to the recognizer and posts the result.

Definition

Visual Basic .NET Public Sub CommitPendingInput()
C# public void CommitPendingInput();
Managed C++ public: void CommitPendingInput();

Exceptions

COMException Leave Site:
ObjectDisposedException Leave Site: The PenInputPanel object is disposed.

Remarks

For western languages, the Handwriting panel sends the collected ink to the recognizer and clears the writing pad. For East Asian languages that use multiple boxes, the Handwriting panel sends recognized characters and clears the boxes. The recognition result is sent to the control to which the PenInputPanel object is attached.

If there is no pending input or the CurrentPanel property is Keyboard, CommitPendingInput does nothing.

If the PenInputPanel object is inactive, calling this method generates an error.

Examples

[C#]

This C# example creates a PenInputPanel object, thePenInputPanel, and attaches it to an InkEdit control, theInkEdit. It adds a VisibleChanged event handler, VisibleChanged_Event, to the form for the PenInputPanel. In the event handler, if the PenInputPanel object becomes invisible, any pending input is sent to the recognizer by calling the CommitPendingInput method.

//...

// 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 PenInputPanelVisibleChanged 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 invisible...
        if (!e.NewVisibility)
        {
            // Send pending input to the recognizer
            theSenderPanel.CommitPendingInput();
        }
    }
}

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example creates a PenInputPanel object, thePenInputPanel, and attaches it to an InkEdit control, theInkEdit. It adds a VisibleChanged event handler, VisibleChanged_Event, to the form for the PenInputPanel. In the event handler, if the PenInputPanel object becomes invisible, any pending input is sent to the recognizer by calling the CommitPendingInput method.

'...

' 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 PenInputPanelVisibleChanged 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 invisible...
       If Not e.NewVisibility Then
          ' Send pending input to the recognizer
            theSenderPanel.CommitPendingInput()
       End If
    End If
End Sub 'VisibleChanged_Event

See Also