ContextNodeType Class
Defines values that specify the ContextNode object type.
Assembly: IAWinFX (in IAWinFX.dll)
The ContextNode.Type property and the InkAnalyzer.FindNodesOfType method frequently reference the fields in System.Windows.Ink.ContextNodeType.
This example sets the Text property of a TextBox named selectedResultsTextBox, to display the string value associated with a selected ContextNode named selectedNode. The example uses the Type property to designate the text display, based on the type value of the ContextNode.
If selectedNode.Type = ContextNodeType.WritingRegion Then Dim writingRegion As WritingRegionNode = CType(selectedNode, WritingRegionNode) selectedResultsTextBox.Text = writingRegion.GetRecognizedString() ElseIf selectedNode.Type = ContextNodeType.Paragraph Then Dim paragraph As ParagraphNode = CType(selectedNode, ParagraphNode) selectedResultsTextBox.Text = paragraph.GetRecognizedString() ElseIf selectedNode.Type = ContextNodeType.Line Then Dim line As LineNode = CType(selectedNode, LineNode) selectedResultsTextBox.Text = line.GetRecognizedString() ElseIf selectedNode.Type = ContextNodeType.InkWord Then Dim inkWord As InkWordNode = CType(selectedNode, InkWordNode) Dim parentNode As ContextNode = inkWord.ParentNode If TypeOf parentNode Is LineNode Then Dim parentLine As LineNode = CType(parentNode, LineNode) ' Put parent line's recognized string into the text box selectedResultsTextBox.Text = parentLine.GetRecognizedString() ' Select the text that corresponds to the ink word Dim subNodes As New ContextNodeCollection(theInkAnalyzer) subNodes.Add(inkWord) Dim start As Integer Dim length As Integer parentLine.GetTextRangeFromNodes(subNodes, start, length) If start >= 0 AndAlso length > 0 Then selectedResultsTextBox.Select(start, length) End If End If ElseIf selectedNode.Type = ContextNodeType.InkDrawing Then Dim drawingNode As InkDrawingNode = CType(selectedNode, InkDrawingNode) selectedResultsTextBox.Text = drawingNode.GetShapeName() ElseIf selectedNode.Type = ContextNodeType.InkBullet Then Dim bulletNode As InkBulletNode = CType(selectedNode, InkBulletNode) selectedResultsTextBox.Text = bulletNode.GetRecognizedString() ElseIf selectedNode.Type = ContextNodeType.CustomRecognizer Then Dim customRecognizer As CustomRecognizerNode = CType(selectedNode, CustomRecognizerNode) selectedResultsTextBox.Text = customRecognizer.GetRecognizedString() ElseIf selectedNode.Type = ContextNodeType.Object Then Dim selectedObject As ObjectNode = CType(selectedNode, ObjectNode) selectedResultsTextBox.Text = selectedObject.GetRecognizedString() Else selectedResultsTextBox.Text = "" End If
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
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.