次の方法で共有


WritingRegionNode クラス

方向が似ている段落のグループを表します。

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

構文

'宣言
Public NotInheritable Class WritingRegionNode _
    Inherits ContextNode
'使用
Dim instance As WritingRegionNode
public sealed class WritingRegionNode : ContextNode
public ref class WritingRegionNode sealed : public ContextNode
public final class WritingRegionNode extends ContextNode
public final class WritingRegionNode extends ContextNode

解説

手書き領域には、上から下など、単一の読み取り方向があります。

さまざまな方向が存在する場合は、同じページの同じドキュメント内に複数の手書き領域が共存できます。たとえば、ユーザーがメモを主に横方向に記述し、いくつかの単語を隅で斜めに走り書きした場合、斜めの単語は別の方向と見なされます。その斜めのテキストに、新しい WritingRegion が作成されます。

WritingRegionNode オブジェクトには、任意の数の次の型の子要素を格納できます。

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

' Find out what's been selected in the text box
Dim selectionStart As Integer = selectedResultsTextBox.SelectionStart
Dim selectionLength As Integer = selectedResultsTextBox.SelectionLength

' Return if no text is selected.
If selectionLength = 0 Then
    Return
End If 
' Get the nodes that correspond to that range
Dim selectedRegionSubNodes As ContextNodeCollection = writingRegion.GetNodesFromTextRange(selectionStart, selectionLength)


' Use the new start and length value to update the
' selection in the TextBox
selectedResultsTextBox.SelectionStart = selectionStart
selectedResultsTextBox.SelectionLength = selectionLength

' First, set all strokes to black
For Each stroke As Stroke In writingRegion.Strokes
    stroke.DrawingAttributes.Color = Colors.Black
Next stroke

' Next, set all selected sub nodes to red
For Each node As ContextNode In selectedRegionSubNodes
    For Each stroke As Stroke In node.Strokes
        stroke.DrawingAttributes.Color = Colors.Red
    Next stroke
Next node
// Find out what's been selected in the text box
int selectionStart = selectedResultsTextBox.SelectionStart;
int selectionLength = selectedResultsTextBox.SelectionLength;

// Return if no text is selected.
if (selectionLength == 0)
    return;

// Get the nodes that correspond to that range
ContextNodeCollection selectedRegionSubNodes =
        writingRegion.GetNodesFromTextRange(ref selectionStart, ref selectionLength);


// Use the new start and length value to update the
// selection in the TextBox
selectedResultsTextBox.SelectionStart = selectionStart;
selectedResultsTextBox.SelectionLength = selectionLength;

// First, set all strokes to black
foreach (Stroke stroke in writingRegion.Strokes)
    stroke.DrawingAttributes.Color = Colors.Black;
// Next, set all selected sub nodes to red
foreach (ContextNode node in selectedRegionSubNodes)
{
    foreach (Stroke stroke in node.Strokes)
    {
        stroke.DrawingAttributes.Color = Colors.Red;
    }
}

継承階層

System.Object
  System.Windows.Ink.ContextNode
    System.Windows.Ink.WritingRegionNode

スレッド セーフ

この型のすべてのパブリック static (Visual Basic では Shared) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

プラットフォーム

Windows Vista

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

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

WritingRegionNode メンバ

System.Windows.Ink 名前空間