共用方式為


PenInputPanel.CommitPendingInput 方法

已取代。將收集的「筆墨」傳送至辨識器,並且傳回辨識結果。PenInputPanel 已被 Microsoft.Ink.TextInput 取代。

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

語法

'宣告
<PermissionSetAttribute(SecurityAction.InheritanceDemand, Name := "FullTrust")> _
<UIPermissionAttribute(SecurityAction.Demand, Window := UIPermissionWindow.SafeTopLevelWindows)> _
<SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted := True)> _
Public Sub CommitPendingInput
'用途
Dim instance As PenInputPanel

instance.CommitPendingInput()
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
[UIPermissionAttribute(SecurityAction.Demand, Window = UIPermissionWindow.SafeTopLevelWindows)]
[SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted = true)]
public void CommitPendingInput()
[PermissionSetAttribute(SecurityAction::InheritanceDemand, Name = L"FullTrust")]
[UIPermissionAttribute(SecurityAction::Demand, Window = UIPermissionWindow::SafeTopLevelWindows)]
[SecurityPermissionAttribute(SecurityAction::Demand, Unrestricted = true)]
public:
void CommitPendingInput()
/** @attribute PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust") */
/** @attribute UIPermissionAttribute(SecurityAction.Demand, Window = UIPermissionWindow.SafeTopLevelWindows) */
/** @attribute SecurityPermissionAttribute(SecurityAction.Demand, Unrestricted = true) */
public void CommitPendingInput()
public function CommitPendingInput()

備註

若是採用西方語言,[手寫] 面板會將收集的筆墨傳送至辨識器,並且清除書寫板。若是採用使用多重方塊的東亞語言,則 [手寫] 面板會傳送辨識的字元並且清除方塊。辨識結果會傳送至附加 PenInputPanel 物件的控制項。

如果沒有暫止的輸入或是 CurrentPanel 屬性為 [鍵盤],則 CommitPendingInput 不會有任何作用。

如果 PenInputPanel 物件為非現用,則呼叫這個方法會產生錯誤。

自 Microsoft® Windows® XP Tablet PC Edition 2005 起,「筆墨」會在使用者輸入的同時進行辨識。因此,CommitPendingInput 函式會將已辨識的文字傳送至不會強制辨識的編輯控制項。

自 Windows XP Tablet PC Edition 2005 起,如果 PenInputPanel 物件為非現用,則 CommitPendingInput 不會產生錯誤,只會傳回。

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

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

範例

這個 C# 範例會建立 PenInputPanel 物件 thePenInputPanel,並且將它附加至 InkEdit 控制項 theInkEdit。它會將 VisibleChanged 事件處理常式 VisibleChanged_Event 加入至 PenInputPanel 的表單。在事件處理常式中,如果 PenInputPanel 物件變成隱藏狀態,則任何暫止的輸入都會透過呼叫 CommitPendingInput 方法傳送至辨識器。

[C#]

//...

// 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();
        }
    }
}

這個 Microsoft Visual Basic® .NET 範例會建立 PenInputPanel 物件 thePenInputPanel,並且將它附加至 InkEdit 控制項 theInkEdit。它會將 VisibleChanged 事件處理常式 VisibleChanged_Event 加入至 PenInputPanel 的表單。在事件處理常式中,如果 PenInputPanel 物件變成隱藏狀態,則任何暫止的輸入都會透過呼叫 CommitPendingInput 方法傳送至辨識器。

[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 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

平台

Windows Vista

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

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

PenInputPanel 類別

PenInputPanel 成員

Microsoft.Ink 命名空間

PenInputPanel.CurrentPanel

PenInputPanel.VisibleChanged