Compartir a través de


ContextNodeType (Clase)

Actualización: noviembre 2007

Define los valores que especifican el tipo del objeto ContextNode.

Espacio de nombres:  Microsoft.Ink
Ensamblado:  Microsoft.Ink.Analysis (en Microsoft.Ink.Analysis.dll)

Sintaxis

'Declaración
Public NotInheritable Class ContextNodeType
'Uso
Dim instance As ContextNodeType
public sealed class ContextNodeType
public ref class ContextNodeType sealed
public final class ContextNodeType
public final class ContextNodeType

Comentarios

La propiedad ContextNode.Type y el método InkAnalyzer.FindNodesOfType usan con frecuencia los campos de esta clase.

Ejemplos

En este ejemplo se establece la propiedad Text de TextBox, selectedResultsTextBox, para mostrar una cadena adecuada para ContextNode, selectedNode. Usa la propiedad Type para elegir el tipo de texto que se va a mostrar, en función del tipo de 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 = String.Empty
End Select
                if (selectedNode.Type == Microsoft.Ink.ContextNodeType.WritingRegion)
                {
                    WritingRegionNode writingRegion = (WritingRegionNode)selectedNode;
                    selectedResultsTextBox.Text = writingRegion.GetRecognizedString();
                }
                else if (selectedNode.Type == Microsoft.Ink.ContextNodeType.Paragraph)
                {
                    ParagraphNode paragraph = (ParagraphNode)selectedNode;
                    selectedResultsTextBox.Text = paragraph.GetRecognizedString();
                }
                else if (selectedNode.Type == Microsoft.Ink.ContextNodeType.Line)
                {
                    LineNode line = (LineNode)selectedNode;
                    selectedResultsTextBox.Text = line.GetRecognizedString();
                }
                else if (selectedNode.Type == Microsoft.Ink.ContextNodeType.InkWord)
                {
                    InkWordNode inkWord = (InkWordNode)selectedNode;
                    ContextNode parentNode = inkWord.ParentNode;
                    if (parentNode is LineNode)
                    {
                        LineNode parentLine = (LineNode)parentNode;
                        // Put parent line's recognized string into the text box
                        selectedResultsTextBox.Text = parentLine.GetRecognizedString();

                        // Select the text that corresponds to the ink word
                        ContextNodeCollection subNodes = new ContextNodeCollection(theInkAnalyzer);
                        subNodes.Add(inkWord);
                        int start = 0;
                        int length = 0;
                        parentLine.GetTextRangeFromNodes(subNodes, out start, out length);
                        if (start >= 0 && length > 0)
                        {
                            selectedResultsTextBox.Select(start, length);
                        }
                    }
                }
                else if (selectedNode.Type == Microsoft.Ink.ContextNodeType.InkDrawing)
                {
                    InkDrawingNode drawingNode = (InkDrawingNode)selectedNode;
                    selectedResultsTextBox.Text = drawingNode.GetShapeName();
                }
                else if (selectedNode.Type == Microsoft.Ink.ContextNodeType.InkBullet)
                {
                    InkBulletNode bulletNode = (InkBulletNode)selectedNode;
                    selectedResultsTextBox.Text = bulletNode.GetRecognizedString();
                }
                else if (selectedNode.Type == Microsoft.Ink.ContextNodeType.CustomRecognizer)
                {
                    CustomRecognizerNode customRecognizer = (CustomRecognizerNode)selectedNode;
                    selectedResultsTextBox.Text = customRecognizer.GetRecognizedString();
                }
                else if (selectedNode.Type == Microsoft.Ink.ContextNodeType.Object)
                {
                    ObjectNode selectedObject = (ObjectNode)selectedNode;
                    selectedResultsTextBox.Text = selectedObject.GetRecognizedString();
                }
                else
                {
                    selectedResultsTextBox.Text = String.Empty;
                }

Jerarquía de herencia

System.Object
  Microsoft.Ink.ContextNodeType

Seguridad para subprocesos

Todos los miembros static (Shared en Visual Basic) públicos de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.

Plataformas

Windows Vista

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Información de versión

.NET Framework

Compatible con: 3.0

Vea también

Referencia

ContextNodeType (Miembros)

Microsoft.Ink (Espacio de nombres)

ContextNode.Type

InkAnalyzer.FindNodesOfType