다음을 통해 공유


ContextNode.Type 속성

업데이트: 2007년 11월

ContextNode 개체의 컨텍스트 노드 형식을 가져옵니다.

네임스페이스:  System.Windows.Ink
어셈블리:  IAWinFX(IAWinFX.dll)

구문

‘선언
Public ReadOnly Property Type As Guid
‘사용 방법
Dim instance As ContextNode
Dim value As Guid

value = instance.Type
public Guid Type { get; }
public:
property Guid Type {
    Guid get ();
}
/** @property */
public Guid get_Type()
public function get Type () : Guid

속성 값

형식: System.Guid
ContextNode 개체의 컨텍스트 노드 형식입니다.

예제

다음 예제에서는 이름이 selectedNode인 ContextNode 개체의 Type 속성을 사용하는 방법을 보여 줍니다. TextBox의 텍스트인 selectedResultsTextBox는 노드 형식에 따라 다르게 채워집니다. 대부분의 경우 인식된 문자열이 사용되지만 InkWord의 경우에는 줄의 인식된 문자열이 사용되고 단어는 TextBox에서 선택됩니다.

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
if (selectedNode.Type == ContextNodeType.WritingRegion)
{
    WritingRegionNode writingRegion = (WritingRegionNode)selectedNode;
    selectedResultsTextBox.Text = writingRegion.GetRecognizedString();
}
else if (selectedNode.Type == ContextNodeType.Paragraph)
{
    ParagraphNode paragraph = (ParagraphNode)selectedNode;
    selectedResultsTextBox.Text = paragraph.GetRecognizedString();
}
else if (selectedNode.Type == ContextNodeType.Line)
{
    LineNode line = (LineNode)selectedNode;
    selectedResultsTextBox.Text = line.GetRecognizedString();
}
else if (selectedNode.Type == 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;
        int length;
        parentLine.GetTextRangeFromNodes(subNodes, out start, out length);
        if (start >= 0 && length > 0)
        {
            selectedResultsTextBox.Select(start, length);
        }
    }
}
else if (selectedNode.Type == ContextNodeType.InkDrawing)
{
    InkDrawingNode drawingNode = (InkDrawingNode)selectedNode;
    selectedResultsTextBox.Text = drawingNode.GetShapeName();
}
else if (selectedNode.Type == ContextNodeType.InkBullet)
{
    InkBulletNode bulletNode = (InkBulletNode)selectedNode;
    selectedResultsTextBox.Text = bulletNode.GetRecognizedString();
}
else if (selectedNode.Type == ContextNodeType.CustomRecognizer)
{
    CustomRecognizerNode customRecognizer = (CustomRecognizerNode)selectedNode;
    selectedResultsTextBox.Text = customRecognizer.GetRecognizedString();
}
else if (selectedNode.Type == ContextNodeType.Object)
{
    ObjectNode selectedObject = (ObjectNode)selectedNode;
    selectedResultsTextBox.Text = selectedObject.GetRecognizedString();
}
else
{
    selectedResultsTextBox.Text = "";
}

플랫폼

Windows Vista

.NET Framework 및 .NET Compact Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

ContextNode 클래스

ContextNode 멤버

System.Windows.Ink 네임스페이스

System.Windows.Ink.ContextNodeType

InkAnalyzer.FindNodesOfType

InkAnalyzerFindNodesOfType(Guid, array<Int32[])

InkAnalyzer.FindNodesOfType