Поделиться через


AnalysisAlternate.AlternateNodes - свойство

Обновлен: Ноябрь 2007

Gets the ContextNode objects that are associated with this alternate.

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink.Analysis (в Microsoft.Ink.Analysis.dll)

Синтаксис

'Декларация
Public ReadOnly Property AlternateNodes As ContextNodeCollection
'Применение
Dim instance As AnalysisAlternate
Dim value As ContextNodeCollection

value = instance.AlternateNodes
public ContextNodeCollection AlternateNodes { get; }
public:
property ContextNodeCollection^ AlternateNodes {
    ContextNodeCollection^ get ();
}
/** @property */
public ContextNodeCollection get_AlternateNodes()
public function get AlternateNodes () : ContextNodeCollection

Значение свойства

Тип: Microsoft.Ink.ContextNodeCollection
The ContextNode objects that are associated with this alternate.

Заметки

Because they correspond to alternates, these ContextNode objects are not descendants of the RootNode of the InkAnalyzer unless they are the top alternate, which is the first element in an AnalysisAlternateCollection.

The returned nodes are the leaf nodes corresponding to the alternate.

AlternateNodes always returns a collection of the leaf nodes, that is, when called on a LineNode the collection will contain InkWordNodes, not the LineNodes.

ms571598.alert_note(ru-ru,VS.90).gifПримечание.

The alternate nodes in this version have a ParentNode property equal to nullссылка null (Nothing в Visual Basic).

Примеры

This example checks to see if an AnalysisAlternate, selectedAlternate, has the same segmentation as the top alternate in an AnalysisAlternateCollection, currentAlternates. Segmentation refers to how the strokes are broken up into ContextNode objects.

Dim hasSameSegmentationAsTop As Boolean = True
If currentAlternates.Count > 0 Then
    Dim topAlternate As AnalysisAlternate = currentAlternates(0)
    ' First check if selected alternate is the top alternate
    If selectedAlternate.Equals(topAlternate) Then
        hasSameSegmentationAsTop = True
    Else
        ' Check to see if they have the same strokes
        If topAlternate.AlternateNodes.Count <> selectedAlternate.AlternateNodes.Count Then
            hasSameSegmentationAsTop = False
        Else
            ' Check that each node matches the alternates
            Dim index As Integer
            For index = 0 To topAlternate.AlternateNodes.Count - 1

                If topAlternate.AlternateNodes(index).Strokes.Count <> _
                    selectedAlternate.AlternateNodes(index).Strokes.Count Then
                    hasSameSegmentationAsTop = False
                    Exit For
                End If

                Dim topStroke As Stroke
                For Each topStroke In topAlternate.AlternateNodes(index).Strokes
                    If (Not selectedAlternate.AlternateNodes(index).Strokes.Contains(topStroke)) Then
                        hasSameSegmentationAsTop = False
                        Exit For
                    End If
                Next topStroke

                If Not hasSameSegmentationAsTop Then
                    Exit For
                End If

            Next index
        End If
    End If
End If
                bool hasSameSegmentationAsTop = true;
                if (currentAlternates.Count > 0)
                {
                    AnalysisAlternate topAlternate = currentAlternates[0];
                    // First check if selected alternate is the top alternate
                    if (selectedAlternate == topAlternate)
                    {
                        hasSameSegmentationAsTop = true;
                    }
                    else
                    {
                        // Check to see if they have the same strokes
                        if (topAlternate.AlternateNodes.Count != selectedAlternate.AlternateNodes.Count)
                        {
                            hasSameSegmentationAsTop = false;
                        }
                        else
                        {
                            // Check that each node matches the alternates
                            for (int i = 0; 
                                (i < topAlternate.AlternateNodes.Count) && hasSameSegmentationAsTop; i++)
                            {
                                if (topAlternate.AlternateNodes[i].Strokes.Count !=
                                      selectedAlternate.AlternateNodes[i].Strokes.Count)
                                {
                                    hasSameSegmentationAsTop = false;
                                    break;
                                }

                                foreach (Stroke stroke in topAlternate.AlternateNodes[i].Strokes)
                                {
                                    if (!selectedAlternate.AlternateNodes[i].Strokes.Contains(stroke))
                                    {
                                        hasSameSegmentationAsTop = false;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

AnalysisAlternate Класс

AnalysisAlternate - члены

Microsoft.Ink - пространство имен