Compartir a través de


ConfirmationType Enumeration

Defines values that specify the type confirmation that can occur on a ContextNodeBase object.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace: System.Windows.Ink.AnalysisCore
Assembly: IACore (in iacore.dll)

Syntax

'Declaration
<FlagsAttribute> _
Public Enumeration ConfirmationType
'Usage
Dim instance As ConfirmationType
[FlagsAttribute] 
public enum ConfirmationType
[FlagsAttribute] 
public enum class ConfirmationType
/** @attribute FlagsAttribute() */ 
public enum ConfirmationType
FlagsAttribute 
public enum ConfirmationType

Members

  Member name Description
NodeTypeAndProperties Specifies that the InkAnalyzer cannot change type or any properties of the specified context node. 
None Specifies that no confirmation is applied. The InkAnalyzer is free to change a context node or any of its descendants as needed. 
TopBoundary Specifies that the InkAnalyzerBase will not perform operations, including adding ink or merging with other ContextNodeBases, that cause the TopBoundary to move beyond the current top boundary. For example: 
  • An application analyzes a set of Ink, and a ParagraphNode is identified.

  • The application confirms the TopBoundary of this paragraph.

  • The user of the application writes new ink above the current paragraph.

  • When analyze is called again, the new ink will not be incorporated into the Confirmed paragraph node.

  • Since only the top boundary is confirmed, the ContextNodeBase can continue to grow in other directions. Deleting strokes can cause the top boundary to move down. Translating the ContextNodeBase can cause the location to change, but will not allow additional ink to be merged in the new location.

It confirms the top left corner of the paragraph, not just the top. This top-left corner can only be updated if strokes are deleted from the top left corner. Adding strokes to the left of the paragraph doesn't merge the strokes with the paragraph, however you can add strokes to the right of the paragraph and below the paragraph

This ConfirmationType is only applicable to paragraph nodes.

Remarks

You can use NodeTypeAndProperties only for ContextNodeBase objects of type InkWord and InkDrawing. Otherwise, an InvalidOperationException is thrown.

Example

The following example is an event handler for the 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. 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 MouseUp mouse up event into ink coordinates, and 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)

        ' The integer array must be exactly the right size. Arrays
        ' begin at zero, so the upper bound is selectedStrokes.Count - 1.
        Dim selectedStrokeIds(selectedStrokes.Count - 1) As Integer

        For i As Integer = 0 To selectedStrokes.Count - 1
            selectedStrokeIds(i) = selectedStrokes(i).Id
        Next

        ' Find the ink word nodes that correspond to those strokes
        Dim selectedNodes As ContextNodeBaseCollection = _
            Me.theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkWord, _
            selectedStrokeIds)

        ' Toggle the confirmation type on these nodes
        Dim selectedNode As ContextNodeBase
        For Each selectedNode In selectedNodes
            If selectedNode.IsNodeTypeAndPropertiesConfirmed = True Then
                selectedNode.Confirm(System.Windows.Ink.AnalysisCore.ConfirmationType.None)
            Else
                selectedNode.Confirm(System.Windows.Ink.AnalysisCore.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);

        int[] selectedStrokeIds = new int[selectedStrokes.Count];

        for (int i = 0; i < selectedStrokes.Count; i++)
        {
            selectedStrokeIds[i] = selectedStrokes[i].Id;
        }

        // Find the ink word nodes that correspond to those strokes
        ContextNodeBaseCollection selectedNodes =
            this.theInkAnalyzerBase.FindNodesOfType(System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.InkWord,
            selectedStrokeIds);

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

        // No longer in "confirm" mode
        this.confirmMode = false;
        this.confirmMenuItem.Checked = false;
            this.theInkCollector.Enabled = 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

System.Windows.Ink.AnalysisCore Namespace
ContextNodeBase.Confirm
System.Windows.Ink.AnalysisCore.ContextNodeBase.IsNodeTypeAndPropertiesConfirmed