次の方法で共有


LineNode.GetTextRangeFromNodes メソッド

LineNode の子孫である ContextNode オブジェクトのコレクションに対応する、認識された文字列内のテキスト範囲を求めます。

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

構文

'宣言
Public Sub GetTextRangeFromNodes ( _
    subTree As ContextNodeCollection, _
    <OutAttribute> ByRef start As Integer, _
    <OutAttribute> ByRef length As Integer _
)
'使用
Dim instance As LineNode
Dim subTree As ContextNodeCollection
Dim start As Integer
Dim length As Integer

instance.GetTextRangeFromNodes(subTree, _
    start, length)
public void GetTextRangeFromNodes(
    ContextNodeCollection subTree,
    out int start,
    out int length
)
public:
void GetTextRangeFromNodes(
    ContextNodeCollection^ subTree, 
    [OutAttribute] int% start, 
    [OutAttribute] int% length
)
public void GetTextRangeFromNodes(
    ContextNodeCollection subTree,
    /** @attribute OutAttribute */ /** @ref */int start,
    /** @attribute OutAttribute */ /** @ref */int length
)
public function GetTextRangeFromNodes(
    subTree : ContextNodeCollection, 
    start : int, 
    length : int
)

パラメータ

  • start
    型 : System.Int32%
    テキスト範囲の開始位置。

解説

subTree に、LineNode の子孫ではない ContextNode オブジェクトが含まれている場合、ArgumentException 例外がスローされます。

subTree パラメータで渡された ContextNode オブジェクトが連続していない場合は、すべての ContextNode オブジェクトが含まれる最小のテキスト範囲が返されます。

次の例では、InkWordNode、inkWord の ParentNodeLineNode であるかどうかを調べます。この条件に該当する場合は、GetRecognizedString の値を TextBox、selectedResultsTextBox に挿入してから、inkWord に対応するテキストを選択します。

Dim parentNode As ContextNode = inkWord.ParentNode
If TypeOf parentNode Is LineNode Then
    Dim parentLine As LineNode = CType(parentNode, LineNode)
    ' Put parent line's recognized string into the text box
    selectedResultsTextBox.Text = parentLine.GetRecognizedString()

    ' Select the text that corresponds to the ink word
    Dim subNodes As New ContextNodeCollection(theInkAnalyzer)
    subNodes.Add(inkWord)
    Dim start As Integer
    Dim length As Integer
    parentLine.GetTextRangeFromNodes(subNodes, start, length)
    If start >= 0 AndAlso length > 0 Then
        selectedResultsTextBox.Select(start, length)
    End If
End If
                    ContextNode parentNode = inkWord.ParentNode;
                    if (parentNode is LineNode)
                    {
                        LineNode parentLine = (LineNode)parentNode;
                        // Put parent line's recognized string into the text box
                        selectedResultsTextBox.Text = parentLine.GetRecognizedString();

                        // Select the text that corresponds to the ink word
                        ContextNodeCollection subNodes = new ContextNodeCollection(theInkAnalyzer);
                        subNodes.Add(inkWord);
                        int start = 0;
                        int length = 0;
                        parentLine.GetTextRangeFromNodes(subNodes, out start, out length);
                        if (start >= 0 && length > 0)
                        {
                            selectedResultsTextBox.Select(start, length);
                        }
                    }

プラットフォーム

Windows Vista

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

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

LineNode クラス

LineNode メンバ

Microsoft.Ink 名前空間