現在の AnalysisAlternate に関連付けられている ContextNode オブジェクトを取得します。
名前空間 : System.Windows.Ink
アセンブリ : IAWinFX (IAWinFX.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
プロパティ値
型 : System.Windows.Ink.ContextNodeCollection
この候補に関連付けられている ContextNode オブジェクト。
解説
これらの ContextNode オブジェクトは候補に対応しているため、AnalysisAlternateCollection 内の最初の要素である第 1 候補でなければ、InkAnalyzer の RootNode の子孫ではありません。
AlternateNodes は、常にリーフ ノードのコレクションを返します。たとえば、AnalysisAlternate() が LineNode である場合、AlternateNodes は、LineNode オブジェクトではなく InkWordNode オブジェクトのコレクションを返します。
例
この例では、AnalysisAlternate、selectedAlternate が、AnalysisAlternateCollection、currentAlternates 内の第 1 候補と同じ区切りを持っているかどうかを調べます。区切りとは、ストロークを ContextNode オブジェクトに分ける方法のことです。
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 = 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 i As Integer
For i = 0 To topAlternate.AlternateNodes.Count - 1
If topAlternate.AlternateNodes(i).Strokes.Count <> _
selectedAlternate.AlternateNodes(i).Strokes.Count Then
hasSameSegmentationAsTop = False
Exit For
End If
Dim stroke As Stroke
For Each stroke In topAlternate.AlternateNodes(i).Strokes
If Not selectedAlternate.AlternateNodes(i).Strokes.Contains(stroke) Then
hasSameSegmentationAsTop = False
Exit For
End If
Next stroke
Next i
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