共用方式為


LineNode.GetTextRangeFromNodes 方法

在已辨識的字串中尋找對應於 ContextNode 物件集合的文字範圍,這些物件都是 LineNode 的子代。

命名空間:  System.Windows.Ink
組件:  IAWinFX (在 IAWinFX.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
)

參數

備註

如果 subTree 包含不是 LineNode 之子代的 ContextNode 物件,則會擲回 ArgumentException 例外狀況。

如果 subTree 包含不連續的 ContextNode 物件,則會傳回涵蓋所有 ContextNode 物件的最小文字範圍。

範例

下列範例會採用 InkWordNode (inkWord) 並檢查 ParentNode 是否為 LineNode。如果是,則會將 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;
    int length;
    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 成員

System.Windows.Ink 命名空間