다음을 통해 공유


ContextNode.SetStrokes 메서드

업데이트: 2007년 11월

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

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

구문

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

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

매개 변수

설명

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

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

예제

다음 예제는 이름이 PopulateNode인 메서드로, TreeView를 문서 모델로 사용하여 데이터 프록시를 통해 InkAnalyzer에 대한 컨텍스트 노드 트리를 저장하고 로드하는 방법을 보여 줍니다. DocumentNodeData 클래스는 각 TreeViewItem 개체의 Tag 속성이 DocumentNodeData 개체로 설정된 경우 ContextNode 데이터를 문서 모델에 저장합니다.

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

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

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

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

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

    System.Diagnostics.Debug.WriteLine(String.Format("IDocumentModel.PopulateNode: populate {0} {1}.", analyzerNode.ToString(), GetRecognizedString(analyzerNode)))
    System.Diagnostics.Debug.Indent()

    ' Get the document node associated with the analyzer node.
    Dim documentNode As TreeViewItem = 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.
    For Each identifier As Guid 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 TreeViewItem
        For Each documentSubNode In  documentNode.Items
            ' 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(
            ContextNode analyzerNode,
            InkAnalyzer theInkAnalyzer)
        {
            System.Diagnostics.Debug.WriteLine(string.Format(
                "IDocumentModel.PopulateNode: populate {0} {1}.",
                analyzerNode.ToString(), GetRecognizedString(analyzerNode)));
            System.Diagnostics.Debug.Indent();

            // Get the document node associated with the analyzer node.
            TreeViewItem 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 (TreeViewItem documentSubNode in documentNode.Items)
                {
                    // 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 멤버

System.Windows.Ink 네임스페이스