ContextNode オブジェクトのコレクションの場合、このメソッドは認識された文字列で対応するテキスト範囲を検索します。
名前空間 : 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 WritingRegionNode
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
型 : System.Windows.Ink.ContextNodeCollection
WritingRegionNode の子孫である ContextNode オブジェクトのコレクション。
- start
型 : System.Int32%
テキスト範囲の開始点。
- length
型 : System.Int32%
テキスト範囲の長さ。
解説
subTree に、InkWritingNode の子孫ではない ContextNode が含まれている場合、ArgumentException がスローされます。
subTree に、連続していない ContextNode オブジェクトが含まれる場合、すべての ContextNode オブジェクトを含む最小のテキスト範囲が返されます。
例
次の例では、writingRegion という名前のWritingRegionNode 内の最後の段落を検索します。次に、この段落に対応するテキスト範囲を検索し、selectedResultsTextBox という名前の TextBox に GetRecognizedString の値を設定して、最後の段落に対応するテキストを選択します。
Dim paragraphs As ContextNodeCollection = theInkAnalyzer.FindNodesOfType(ContextNodeType.Paragraph)
Dim lastParagraph As ParagraphNode = Nothing
Dim maxY As Double = Double.MinValue
Dim paragraph As ParagraphNode
For Each paragraph In paragraphs
If paragraph.Location.GetBounds().Bottom > maxY Then
maxY = paragraph.Location.GetBounds().Bottom
lastParagraph = paragraph
End If
Next paragraph
If lastParagraph Is Nothing Then
Return
End If
' Create a collection to hold this line
Dim lastParagraphCollection As New ContextNodeCollection(theInkAnalyzer)
lastParagraphCollection.Add(lastParagraph)
' Find corresponding start and length
Dim start, length As Integer
writingRegion.GetTextRangeFromNodes(lastParagraphCollection, start, length)
' Select this in the text box
selectedResultsTextBox.Text = writingRegion.GetRecognizedString()
selectedResultsTextBox.Select(start, length)
ContextNodeCollection paragraphs =
theInkAnalyzer.FindNodesOfType(ContextNodeType.Paragraph);
ParagraphNode lastParagraph = null;
double maxY = double.MinValue;
foreach (ParagraphNode paragraph in paragraphs)
{
if (paragraph.Location.GetBounds().Bottom > maxY)
{
maxY = paragraph.Location.GetBounds().Bottom;
lastParagraph = paragraph;
}
}
if (lastParagraph == null)
return;
// Create a collection to hold this line
ContextNodeCollection lastParagraphCollection = new ContextNodeCollection(theInkAnalyzer);
lastParagraphCollection.Add(lastParagraph);
// Find corresponding start and length
int start, length;
writingRegion.GetTextRangeFromNodes(lastParagraphCollection, out start, out length);
// Select this in the text box
selectedResultsTextBox.Text = writingRegion.GetRecognizedString();
selectedResultsTextBox.Select(start, length);
プラットフォーム
Windows Vista
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 3.0