次の方法で共有


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

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

名前空間 :  System.Windows.Ink
アセンブリ :  IAWinFX (IAWinFX.dll 内)

構文

'宣言
Public Function GetNodesFromTextRange ( _
    ByRef start As Integer, _
    ByRef length As Integer, _
    subTree As ContextNodeCollection _
) As ContextNodeCollection
'使用
Dim instance As RootNode
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

パラメータ

戻り値

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

解説

start パラメータと length パラメータは、返された ContextNodeCollection と関連付けられた文字列全体を指定するように変更できる参照値です。たとえば、GetRecognizedString の戻り値が "I am late" で、start = 6 および length = 1 という値を渡すと、これらのパラメータは文字 "a" に対応します。したがって、ContextNodeCollection は、1 つの ContextNode のみを含む可能性が高くなります (つまり、"late" という語に対応する InkWordNode)。この例では、start の値は 5 に、length の値は 4 に変更されます ("late" という語全体に対応)。

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

start パラメータは、subTree パラメータ内のノードに関連しています。前の例では、"am" および "late" のノードを持つが、"I" のノードは持たない subTree パラメータを渡した場合、start パラメータが 3 で長さが 4 であるとは、"late" という語のテキスト範囲を表します。

次の例では、GetNodesFromTextRange メソッドを使用して、選択したテキストに対応するストロークをマークします。この例のコードでは、theResultsTextBox という名前のTextBoxText プロパティが、GetRecognizedString メソッドによって返される値に設定されることを前提にしています。また、ユーザーが theResultsTextBox からテキストの一部を選択し、theInkAnalyzer という名前の InkAnalyzer があることを前提にしています。

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

    ' Set all strokes to black
    For Each stroke As Stroke In theRootNode.Strokes
        stroke.DrawingAttributes.Color = Colors.Black
    Next stroke
    ' Set strokes in the collection to red
    For Each node As ContextNode In selectedNodes
        For Each stroke As Stroke In node.Strokes
            stroke.DrawingAttributes.Color = Colors.Red
        Next stroke
    Next node

End Sub 'showLastWritingRegion_Click
// Get the nodes that correspond to this start and length
ContextNodeCollection selectedNodes =
    theRootNode.GetNodesFromTextRange(ref start, ref length, lastRegionCollection);

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

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

プラットフォーム

Windows Vista

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

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

RootNode クラス

RootNode メンバ

GetNodesFromTextRange オーバーロード

System.Windows.Ink 名前空間