Compartir a través de


ContextNode.IsConfirmed Method

Returns whether the current ContextNode has been confirmed with the specified ConfirmationType.

Namespace: System.Windows.Ink
Assembly: IAWinFX (in iawinfx.dll)

Syntax

'Declaration
Public Function IsConfirmed ( _
    type As ConfirmationType _
) As Boolean
'Usage
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
Not applicable.

Parameters

  • type
    The type of confirmation to perform on the current ContextNode.

Return Value

true if the ContextNode is confirmed with the specified ConfirmationType; otherwise, false.

Example

The following example allows the user to indicate which strokes have been analyzed correctly. This example is an event handler for a PreviewMouseUp event on an InkCanvas, theInkCanvas. When the CheckBox, confirmMode, is checked, the user clicks a word to confirm it (or to turn off confirmation if the node is already confirmed). The example uses StrokeCollection.HitTest(Point) and FindNodesOfType to find the appropriate nodes. After the nodes are found, Confirm is called to toggle the confirmation. Finally, the TreeView is rebuilt to show which nodes have been confirmed and the PreviewMouseUp event is handled.

Sub theInkCanvas_PreviewMouseDown(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArgs)

    If Me.confirmMode.IsChecked Then

        ' Find the ink word nodes that correspond to those strokes
        Dim position As Point = e.GetPosition(theInkCanvas)
        Dim hitStrokes As StrokeCollection = theInkCanvas.Strokes.HitTest(position)

        Dim selectedNodes As ContextNodeCollection = _
            Me.theInkAnalyzer.FindNodesOfType(ContextNodeType.InkWord, _
            hitStrokes)

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

        ' Rebuild the TreeView to show which context nodes are confirmed.
        Me.BuildTree()

        ' Handle the MouseDown event to prevent the InkCanvas from
        ' selecting the stroke.
        e.Handled = True
    End If

End Sub 'theInkCanvas_PreviewMouseDown
void theInkCanvas_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
    if ((bool)this.confirmMode.IsChecked)
    {
        // Find the ink word nodes that correspond to those strokes
        Point position = e.GetPosition(theInkCanvas);
        StrokeCollection hitStrokes = theInkCanvas.Strokes.HitTest(position);

        ContextNodeCollection selectedNodes =
            this.theInkAnalyzer.FindNodesOfType(ContextNodeType.InkWord,
            hitStrokes);

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

        // Rebuild the TreeView to show which context nodes are confirmed.
        this.BuildTree();

        // Handle the MouseDown event to prevent the InkCanvas from
        // selecting the stroke.
        e.Handled = true;
    }
}

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

ContextNode Class
ContextNode Members
System.Windows.Ink Namespace