次の方法で共有


InkAnalyzer.AddStroke メソッド (Stroke)

StrokeInkAnalyzer に追加し、アクティブな入力スレッドのロケール識別子をストロークに割り当てます。

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

構文

'宣言
Public Function AddStroke ( _
    strokeToAdd As Stroke _
) As ContextNode
'使用
Dim instance As InkAnalyzer
Dim strokeToAdd As Stroke
Dim returnValue As ContextNode

returnValue = instance.AddStroke(strokeToAdd)
public ContextNode AddStroke(
    Stroke strokeToAdd
)
public:
ContextNode^ AddStroke(
    Stroke^ strokeToAdd
)
public ContextNode AddStroke(
    Stroke strokeToAdd
)
public function AddStroke(
    strokeToAdd : Stroke
) : ContextNode

パラメータ

戻り値

型 : Microsoft.Ink.ContextNode
strokeToAdd が追加された ContextNode

解説

InkAnalyzer は、StrokeRootNode プロパティの SubNodes コレクション内の UnclassifiedInkNode に追加します。Stroke、strokeToAdd にアクティブな入力スレッドのロケール識別子を割り当て、同じロケール識別子のストロークを格納する最初の UnclassifiedInkNode に追加します。そのような UnclassifiedInkNode が存在しない場合、新しい UnclassifiedInkNode が作成され、strokeToAdd が新しい UnclassifiedInkNode に追加されます。

このメソッドは、DirtyRegion を、領域の現在の値と追加されたストロークの境界ボックスの結合に拡張します。

ストロークが既に InkAnalyzer に結合されている場合、InkAnalyzer は例外をスローします。

この例では次の処理を行います。

  • 新しい Microsoft.Ink.InkCollector オブジェクト theInkCollector を初期化します。

  • InkCollector.Stroke イベント ハンドラ theInkCollector_Stroke を theInkCollector に結合します。

  • InkCollector オブジェクトの Ink からストローク データを分析できる新しい InkAnalyzer、theInkAnalyzer を初期化します。

' Create and enable the InkCollector and attach event handlers.
Me.theInkCollector = New Microsoft.Ink.InkCollector(Me.theInkingPanel)
AddHandler Me.theInkCollector.Stroke, AddressOf Me.theInkCollector_Stroke
Me.theInkCollector.Enabled = True

' Create the InkAnalyzer.
Me.theInkAnalyzer = New Microsoft.Ink.InkAnalyzer(Me.theInkCollector.Ink, Me)
// Create and enable the InkCollector and attach event handlers.
this.theInkCollector =
    new Microsoft.Ink.InkCollector(this.theInkingPanel);
this.theInkCollector.Stroke +=
    new Microsoft.Ink.InkCollectorStrokeEventHandler(
        this.theInkCollector_Stroke);
this.theInkCollector.Enabled = true;

// Create the InkAnalyzer.
this.theInkAnalyzer =
    new Microsoft.Ink.InkAnalyzer(this.theInkCollector.Ink, this);

この例では、次に theInkCollector_Stroke イベント ハンドラが、theInkCollector に追加されているストロークを受け取り、theInkAnalyzer に追加します。

''' <summary>
''' The ink collector's InkAdded event handler.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The event data.</param>
Sub theInkCollector_Stroke( _
    ByVal sender As Object, ByVal e As Microsoft.Ink.InkCollectorStrokeEventArgs)

    ' Add the new stroke to the InkAnalyzer.
    Me.theInkAnalyzer.AddStroke(e.Stroke)

End Sub 'theInkCollector_Stroke
/// <summary>
/// The ink collector's Stroke event handler.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The event data.</param>
void theInkCollector_Stroke(
    object sender, Microsoft.Ink.InkCollectorStrokeEventArgs e)
{
    // Add the new stroke to the InkAnalyzer.
    this.theInkAnalyzer.AddStroke(e.Stroke);
}

プラットフォーム

Windows Vista

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

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

InkAnalyzer クラス

InkAnalyzer メンバ

AddStroke オーバーロード

Microsoft.Ink 名前空間

InkAnalyzer.AddStrokes

InkAnalyzer.RemoveStroke

InkAnalyzer.RemoveStrokes