AnalysisAlternateBase.AlternateNodes 屬性
取得與這個替代項目相關聯的 ContextNodeBase 物件。
命名空間: System.Windows.Ink.AnalysisCore
組件: IACore (在 IACore.dll 中)
語法
'宣告
Public ReadOnly Property AlternateNodes As ContextNodeBaseCollection
'用途
Dim instance As AnalysisAlternateBase
Dim value As ContextNodeBaseCollection
value = instance.AlternateNodes
public ContextNodeBaseCollection AlternateNodes { get; }
public:
property ContextNodeBaseCollection^ AlternateNodes {
ContextNodeBaseCollection^ get ();
}
/** @property */
public ContextNodeBaseCollection get_AlternateNodes()
public function get AlternateNodes () : ContextNodeBaseCollection
屬性值
型別:System.Windows.Ink.AnalysisCore.ContextNodeBaseCollection
與這個替代項目相關聯的 ContextNodeBase 物件。
備註
因為這些 ContextNodeBase 物件會對應至替代項目,所以除非它們是最佳替代項目 (即 AnalysisAlternateBaseCollection 內的第一個項目),否則不會是 InkAnalyzerBase 之 RootNode 的子代 (Descendant)。
範例
這個範例會判斷 AnalysisAlternateBase (selectedAlternate) 是否具有與 AnalysisAlternateBaseCollection (currentAlternates) 中的頂端替代項目相同的分割。分割表示筆劃分為 ContextNodeBase 物件的方式。
Dim hasSameSegmentationAsTop As Boolean = True
If currentAlternates.Count > 0 Then
Dim topAlternate As AnalysisAlternateBase = 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
For index As Integer = 0 To topAlternate.AlternateNodes.Count - 1
Dim selectedAlternateNodesStrokes As Strokes = _
theInk.CreateStrokes(selectedAlternate.AlternateNodes(index).GetStrokeIds())
Dim topAlternateNodesStrokes As Strokes = _
theInk.CreateStrokes(topAlternate.AlternateNodes(index).GetStrokeIds())
For Each topStroke As Stroke In topAlternateNodesStrokes
If (Not selectedAlternateNodesStrokes.Contains(topStroke)) Then
hasSameSegmentationAsTop = False
Exit For
End If
Next topStroke
Next index
End If
End If
End If
bool hasSameSegmentationAsTop = true;
if (currentAlternates.Count > 0)
{
AnalysisAlternateBase 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; i++)
{
Strokes selectedAlternateNodesStrokes =
theInk.CreateStrokes(selectedAlternate.AlternateNodes[i].GetStrokeIds());
Strokes topAlternateNodesStrokes =
theInk.CreateStrokes(topAlternate.AlternateNodes[i].GetStrokeIds());
foreach (Stroke stroke in topAlternateNodesStrokes)
{
if (!selectedAlternateNodesStrokes.Contains(stroke))
{
hasSameSegmentationAsTop = false;
break;
}
}
}
}
}
}
平台
Windows Vista, Windows XP SP2, Windows Server 2003
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0