ContextNodeType Class
.NET Framework 3.0
Defines values that specify the type of ContextNode object.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink.Analysis (in microsoft.ink.analysis.dll)
Assembly: Microsoft.Ink.Analysis (in microsoft.ink.analysis.dll)
The ContextNode.Type property and the InkAnalyzer.FindNodesOfType method frequently use the fields of this class.
This example sets the Text property of a TextBox, selectedResultsTextBox, to show an appropriate string for a ContextNode, selectedNode. It uses the Type property to choose the kind of text to show, depending on the type of the ContextNode.
Select Case selectedNode.Type Case Microsoft.Ink.ContextNodeType.WritingRegion Dim writingRegion As WritingRegionNode = _ CType(selectedNode, WritingRegionNode) selectedResultsTextBox.Text = writingRegion.GetRecognizedString() Case Microsoft.Ink.ContextNodeType.Paragraph Dim paragraph As ParagraphNode = _ CType(selectedNode, ParagraphNode) selectedResultsTextBox.Text = paragraph.GetRecognizedString() Case Microsoft.Ink.ContextNodeType.Line Dim line As LineNode = _ CType(selectedNode, LineNode) selectedResultsTextBox.Text = line.GetRecognizedString() Case Microsoft.Ink.ContextNodeType.InkWord 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 ' Show the time stamp If inkWord.ContainsPropertyData(Me.timeStampGuid) Then Dim timeStamp As DateTime = _ CType(inkWord.GetPropertyData(Me.timeStampGuid), DateTime) timeStampLabel.Text = timeStamp.ToShortTimeString() End If ' Snippet to demonstrate GetPropertyDataIds Dim propertyDataIds() As Guid = inkWord.GetPropertyDataIds() ' Snippets to demonstrate loading and saving Dim data As Byte() = inkWord.SavePropertiesData() If (Not inkWord.LoadPropertiesData(data)) Then MessageBox.Show("Cannot load property data") End If Case Microsoft.Ink.ContextNodeType.InkDrawing Dim drawingNode As InkDrawingNode = CType(selectedNode, InkDrawingNode) selectedResultsTextBox.Text = drawingNode.GetShapeName() Case Microsoft.Ink.ContextNodeType.InkBullet Dim bulletNode As InkBulletNode = CType(selectedNode, InkBulletNode) selectedResultsTextBox.Text = bulletNode.GetRecognizedString() Case Microsoft.Ink.ContextNodeType.Object Dim selectedObject As ObjectNode = selectedNode selectedResultsTextBox.Text = selectedObject.GetRecognizedString() Case Microsoft.Ink.ContextNodeType.CustomRecognizer Dim customRecognizer As CustomRecognizerNode = selectedNode selectedResultsTextBox.Text = customRecognizer.GetRecognizedString() Case Else selectedResultsTextBox.Text = "" End Select
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.Community Additions
ADD
Show: