共用方式為


ContextNode.IsConfirmed 方法

取得值,這個值表示 ContextNode 物件是否已確認。InkAnalyzer 無法變更節點型別,以及已確認物件的相關筆劃。

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

語法

'宣告
Public Function IsConfirmed ( _
    type As ConfirmationType _
) As Boolean
'用途
Dim instance As ContextNode
Dim type As ConfirmationType
Dim returnValue As Boolean

returnValue = instance.IsConfirmed(type)
public bool IsConfirmed(
    ConfirmationType type
)
public:
bool IsConfirmed(
    ConfirmationType type
)
public boolean IsConfirmed(
    ConfirmationType type
)
public function IsConfirmed(
    type : ConfirmationType
) : boolean

參數

傳回值

型別:System.Boolean
如果節點型別已確認,則為 true,否則為 false。

範例

下列範例會使用 IsConfirmed() 方法來切換 ContextNode 的確認狀態。這個範例是 Panel (英文) (變數名稱為 theNotesPanel) 上 Control.MouseUp (英文) 事件的處理常式,它會透過 InkCollector (變數名稱為 theInkCollector) 收集筆墨。應用程式有 Boolean (英文) (變數名稱為 confirmMode),是由 MenuItem (英文) (變數名稱為 confirmMenuItem) 設定。在「確認」模式中時,使用者按一下文字即可加以確認 (或在節點已確認時關閉確認)。這個範例會將放開滑鼠事件轉換成筆墨座標,並使用 HitTestFindNodesOfType 找出適當的節點。找到節點之後,就會呼叫 Confirm 以切換確認。最後,會使應用程式離開「確認」模式。

Private Sub theNotesPanel_MouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles theNotesPanel.MouseUp
    If Me.confirmMode = True Then
        ' Translate coordinates into ink dimensions
        Dim hitPoint As New Point(e.X, e.Y)
        Dim panelGraphics As Graphics = Me.theNotesPanel.CreateGraphics()
        Me.theInkCollector.Renderer.PixelToInkSpace(panelGraphics, hitPoint)
        panelGraphics.Dispose()

        ' Find the strokes that the user selected
        Dim selectedStrokes As Strokes = Me.theInkCollector.Ink.HitTest(hitPoint, 10)

        ' Find the ink word nodes that correspond to those strokes
        Dim selectedNodes As ContextNodeCollection = _
            Me.theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.InkWord, _
            selectedStrokes)

        ' Toggle the confirmation type on these nodes
        Dim selectedNode As ContextNode
        For Each selectedNode In selectedNodes
            If selectedNode.IsConfirmed(ConfirmationType.NodeTypeAndProperties) = True Then
                selectedNode.Confirm(Microsoft.Ink.ConfirmationType.None)
            Else
                selectedNode.Confirm(Microsoft.Ink.ConfirmationType.NodeTypeAndProperties)
            End If
        Next selectedNode

        ' No longer in "confirm" mode
        Me.confirmMode = False
        Me.ConfirmMenuItem.Checked = False
        Me.theInkCollector.Enabled = True
    End If

End Sub
private void theNotesPanel_MouseUp(object sender, MouseEventArgs e)
{
    if (this.confirmMode)
    {
        // Translate coordinates into ink dimensions
        Point hitPoint = new Point(e.X, e.Y);
        Graphics panelGraphics = this.theNotesPanel.CreateGraphics();
        this.theInkCollector.Renderer.PixelToInkSpace(panelGraphics, ref hitPoint);
        panelGraphics.Dispose();

        // Find the strokes that the user selected
        Strokes selectedStrokes = this.theInkCollector.Ink.HitTest(hitPoint, 10);

        // Find the ink word nodes that correspond to those strokes
        ContextNodeCollection selectedNodes =
            this.theInkAnalyzer.FindNodesOfType(Microsoft.Ink.ContextNodeType.InkWord,
            selectedStrokes);

        // Toggle the confirmation type on these nodes
        foreach (ContextNode selectedNode in selectedNodes)
        {
            if (selectedNode.IsConfirmed(ConfirmationType.NodeTypeAndProperties))
            {
                selectedNode.Confirm(Microsoft.Ink.ConfirmationType.None);
            }
            else
            {
                selectedNode.Confirm(Microsoft.Ink.ConfirmationType.NodeTypeAndProperties);
            }
        }

        // No longer in "confirm" mode
        this.confirmMode = false;
        this.confirmMenuItem.Checked = false;
        this.theInkCollector.Enabled = true;
    }

}

平台

Windows Vista

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

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

ContextNode 類別

ContextNode 成員

Microsoft.Ink 命名空間