次の方法で共有


LineNode.GetNodesFromTextRange メソッド (Int32%, Int32%, ContextNodeCollection)

認識された文字列の中の指定されたテキスト範囲に対応する子孫 ContextNode オブジェクトのコレクション (特定の子孫ノード コレクション内に限定) を返します。

名前空間 :  Microsoft.Ink
アセンブリ :  Microsoft.Ink.Analysis (Microsoft.Ink.Analysis.dll 内)

構文

'宣言
Public Function GetNodesFromTextRange ( _
    ByRef start As Integer, _
    ByRef length As Integer, _
    subTree As ContextNodeCollection _
) As ContextNodeCollection
'使用
Dim instance As LineNode
Dim start As Integer
Dim length As Integer
Dim subTree As ContextNodeCollection
Dim returnValue As ContextNodeCollection

returnValue = instance.GetNodesFromTextRange(start, _
    length, subTree)
public ContextNodeCollection GetNodesFromTextRange(
    ref int start,
    ref int length,
    ContextNodeCollection subTree
)
public:
ContextNodeCollection^ GetNodesFromTextRange(
    int% start, 
    int% length, 
    ContextNodeCollection^ subTree
)
public ContextNodeCollection GetNodesFromTextRange(
    /** @ref */int start,
    /** @ref */int length,
    ContextNodeCollection subTree
)
public function GetNodesFromTextRange(
    start : int, 
    length : int, 
    subTree : ContextNodeCollection
) : ContextNodeCollection

パラメータ

  • start
    型 : System.Int32%
    認識された文字列の subTree 部分の中のテキスト範囲の開始位置。
  • length
    型 : System.Int32%
    認識された文字列の中のテキスト範囲の長さ。

戻り値

型 : Microsoft.Ink.ContextNodeCollection
認識された文字列の中の指定されたテキスト範囲に対応する子孫 ContextNode オブジェクトのコレクション (特定の子孫ノード コレクション内に限定)。

解説

テキスト範囲は、LineNode 全体または RootNode 全体から成る認識された文字列ではなく、この LineNode から成る認識された文字列の subTree 部分のノードを基準として指定する必要があります。

start パラメータおよび length パラメータは、値が変更される可能性があるので、参照として渡されます。たとえば、GetRecognizedString の戻り値が "I am late" で、文字 "a" に対応する値 start = 6 および length = 1 を渡した場合、ContextNodeCollectionContextNode ("late" という語に対応する InkWordNode) は 1 つのみとなる可能性が高くなります。この場合、start の値は 5 に、length の値は 4 に変更されます ("late" という語全体に対応)。

ms569629.alert_note(ja-jp,VS.90).gifメモ :

start パラメータは、subTree パラメータ内のノードを基準とします。前の例で渡した subTree パラメータに、"am" および "late" のノードが含まれているけれども、"I" のノードは含まれていない場合は、"late" という語のテキスト範囲の start パラメータは 3、長さは 4 となります。

次の例では、LineNode、line 内の最後の単語に対応する 1 つの ContextNode オブジェクトが含まれる ContextNodeCollection オブジェクト lastLineCollection を使用します。すべての Strokes の色を黒にしますが、最後の行の中の選択されているテキストに対応するストロークだけは赤色にします。

' Get the nodes that correspond to this start and length
Dim selectedNodes As ContextNodeCollection = _
    line.GetNodesFromTextRange(start, length, lastWordCollection)

' Set all strokes to black
Dim stroke As Stroke
For Each stroke In line.Strokes
    stroke.DrawingAttributes = New DrawingAttributes(Color.Black)
Next

' Set strokes in the collection to red
Dim node As ContextNode
For Each node In selectedNodes
    For Each stroke In node.Strokes
        stroke.DrawingAttributes = New DrawingAttributes(Color.Red)
    Next
Next
// Get the nodes that correspond to this start and length
ContextNodeCollection selectedNodes =
    line.GetNodesFromTextRange(ref start, ref length, lastWordCollection);

// Set all strokes to black
foreach (Stroke stroke in line.Strokes)
    stroke.DrawingAttributes = new DrawingAttributes(Color.Black);

// Set strokes in the collection to red
foreach (ContextNode node in selectedNodes)
{
    foreach (Stroke stroke in node.Strokes)
    {
        stroke.DrawingAttributes = new DrawingAttributes(Color.Red);
    }
}

プラットフォーム

Windows Vista

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

LineNode クラス

LineNode メンバ

GetNodesFromTextRange オーバーロード

Microsoft.Ink 名前空間