ContextNode.IsConfirmed Method

Gets a value that indicates whether the ContextNode object is confirmed. InkAnalyzer cannot change the node type and associated strokes for confirmed objects.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink.Analysis (in Microsoft.Ink.Analysis.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 function IsConfirmed(
    type : ConfirmationType
) : boolean

Parameters

Return Value

Type: System.Boolean
true if the node type is confirmed; otherwise, false.

Examples

The following example uses the IsConfirmed method to switch the confirmation state of the ContextNode. The example is an event handler for the Control.MouseUp event on a Panel, theNotesPanel, which is collecting ink through an InkCollector, theInkCollector. The application has a Boolean, confirmMode, which is set by a MenuItem, confirmMenuItem. When in "confirm" mode, the user clicks a word to confirm it (or to turn off confirmation if the node is already confirmed). The example converts the mouse up event into ink coordinates. It uses HitTest and FindNodesOfType to find the appropriate nodes. After the nodes are found, Confirm is called to toggle the confirmation. Finally, the application is taken out of "confirm" mode.

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;
    }

}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

ContextNode Class

ContextNode Members

Microsoft.Ink Namespace