다음을 통해 공유


ContextNode.SetStrokes 메서드

업데이트: 2007년 11월

지정된 스트로크를 ContextNode 개체에 설정합니다.

네임스페이스:  Microsoft.Ink
어셈블리:  Microsoft.Ink.Analysis(Microsoft.Ink.Analysis.dll)

구문

‘선언
Public Sub SetStrokes ( _
    strokes As Strokes _
)
‘사용 방법
Dim instance As ContextNode
Dim strokes As Strokes

instance.SetStrokes(strokes)
public void SetStrokes(
    Strokes strokes
)
public:
void SetStrokes(
    Strokes^ strokes
)
public void SetStrokes(
    Strokes strokes
)
public function SetStrokes(
    strokes : Strokes
)

매개 변수

설명

이 메서드는 DirtyRegion을 업데이트하지 않습니다.

스트로크 컬렉션의 지정된 스트로크 중 이미 InkAnalyzer에 설정된 스트로크가 있으면 ArgumentException이 throw됩니다.

예제

다음 예제는 System.Windows.Forms.TreeView를 문서 모델로 사용하여 데이터 프록시에서 InkAnalyzer의 대한 컨텍스트 노드를 저장하고 로드하는 방법을 보여 주는 샘플 코드의 PopulateNode라는 메서드입니다 각 TreeNode 개체의 Tag 속성이 DocumentNodeData 개체로 설정된 경우 DocumentNodeData 클래스는 문서 모델에 ContextNode 개체를 저장합니다.

PopulateNode 메서드는 InkAnalyzer 개체의 스트로크, 속성 데이터, 주석 형식, 자식 노드 및 링크를 추가하여 ContextNode 개체를 완전히 채웁니다. 이 메서드는 SetStrokes를 사용하여 스트로크를 추가합니다. 데이터의 출처는 해당 TreeNode에서 가져온 DocumentNodeData 개체입니다.

  • this[analyzerNode.Id]는 문서 모델 클래스에서 GuidTreeNode에 매핑하는 인덱서입니다. VB.NET의 경우에는 Me(analyzerNode.Id)입니다.

  • AddLinksToAnalyer는 문서 모델 클래스에서 링크를 ContextNode에 추가하는 메서드입니다.

노드가 완전히 채워진 후 PartiallyPopulated 속성은 false로 설정됩니다. 데이터 프록시에 대한 자세한 내용은 Data Proxy with Ink Analysis을를 참조하십시오.

Sub PopulateNode(ByVal analyzerNode As Microsoft.Ink.ContextNode, _
                 ByVal theInkAnalyzer As Microsoft.Ink.InkAnalyzer) _
                 Implements IDocumentModel.PopulateNode

    System.Diagnostics.Debug.WriteLine( _
        String.Format("IDocumentModel.PopulateNode: populate {0} {1}.", _
        TreeViewDocumentModel.GetContextNodeTypeName(analyzerNode.Type), analyzerNode.Id))

    System.Diagnostics.Debug.Indent()

    ' Get the document node associated with the analyzer node.
    Dim documentNode As TreeNode = Me(analyzerNode.Id)
    If documentNode Is Nothing Then
        Throw New ApplicationException("The requested node does not exist in the document model.")
    End If

    ' Get the data associated with the node.
    Dim nodeData As DocumentNodeData = documentNode.Tag '

    ' Copy any application specific data associated with the node to the
    ' partially populated ContextNode.
    Dim identifier As Guid
    For Each identifier In nodeData.GetPropertyDataIds()
        analyzerNode.AddPropertyData(identifier, nodeData.GetPropertyData(identifier))
    Next identifier

    ' Check if the partially populated ContextNode is an ink leaf node.
    If nodeData.IsInkLeafNode Then
        ' Add the strokes to the context node.
        analyzerNode.SetStrokes(nodeData.Strokes)
    Else
        ' Add each child subnode as a partially populated ContextNode.
        Dim documentSubNode As TreeNode
        For Each documentSubNode In documentNode.Nodes
            ' Get the DocumentNode data for the 
            Dim subNodeData As DocumentNodeData = documentSubNode.Tag

            If analyzerNode.SubNodes.IndexOf(nodeData.Id) <> -1 Then
                analyzerNode.CreatePartiallyPopulatedSubNode( _
                    subNodeData.Type, subNodeData.Id, subNodeData.Location)
            End If

        Next documentSubNode
    End If

    ' Add links to the ContextNode.
    Me.AddLinksToAnalyzer(documentNode, analyzerNode, theInkAnalyzer)

    ' Update the partially populated flag.
    analyzerNode.PartiallyPopulated = False

    System.Diagnostics.Debug.Unindent()

End Sub 'IDocumentModel.PopulateNode
        void IDocumentModel.PopulateNode(
            Microsoft.Ink.ContextNode analyzerNode,
            Microsoft.Ink.InkAnalyzer theInkAnalyzer)
        {
            System.Diagnostics.Debug.WriteLine(string.Format(
                "IDocumentModel.PopulateNode: populate {0} {1}.",
                TreeViewDocumentModel.GetContextNodeTypeName(analyzerNode.Type),
                analyzerNode.Id));
            System.Diagnostics.Debug.Indent();

            // Get the document node associated with the analyzer node.
            TreeNode documentNode = this[analyzerNode.Id];
            if (null == documentNode)
            {
                throw new ApplicationException(
                    "The requested node does not exist in the document model.");
            }

            // Get the data associated with the node.
            DocumentNodeData nodeData = documentNode.Tag as DocumentNodeData;

            // Copy any application specific data associated with the node to the
            // partially populated ContextNode.
            foreach (Guid identifier in nodeData.GetPropertyDataIds())
            {
                analyzerNode.AddPropertyData(
                    identifier, nodeData.GetPropertyData(identifier));
            }

            // Check if the partially populated ContextNode is an ink leaf node.
            if (nodeData.IsInkLeafNode)
            {
                // Add the strokes to the context node.
                analyzerNode.SetStrokes(nodeData.Strokes);
            }
            else
            {
                // Add each child subnode as a partially populated ContextNode.
                foreach (TreeNode documentSubNode in documentNode.Nodes)
                {
                    // Get the DocumentNode data for the 
                    DocumentNodeData subNodeData = documentSubNode.Tag as DocumentNodeData;

                    if (analyzerNode.SubNodes.IndexOf(nodeData.Id) != -1)
                    {
                        analyzerNode.CreatePartiallyPopulatedSubNode(
                            subNodeData.Type, subNodeData.Id, subNodeData.Location);
                    }
                }
            }

            // Add links to the ContextNode.
            this.AddLinksToAnalyzer(documentNode, analyzerNode, theInkAnalyzer);

            // Update the partially populated flag.
            analyzerNode.PartiallyPopulated = false;

            System.Diagnostics.Debug.Unindent();
        }

플랫폼

Windows Vista

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

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

ContextNode 클래스

ContextNode 멤버

Microsoft.Ink 네임스페이스