次の方法で共有


InkAnalyzer.AddStrokes メソッド (Strokes, Int32)

ストロークのコレクションを InkAnalyzer に追加し、特定のロケール識別子を各ストロークに割り当てます。

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

構文

'宣言
Public Function AddStrokes ( _
    strokesToAdd As Strokes, _
    languageId As Integer _
) As ContextNode
'使用
Dim instance As InkAnalyzer
Dim strokesToAdd As Strokes
Dim languageId As Integer
Dim returnValue As ContextNode

returnValue = instance.AddStrokes(strokesToAdd, _
    languageId)
public ContextNode AddStrokes(
    Strokes strokesToAdd,
    int languageId
)
public:
ContextNode^ AddStrokes(
    Strokes^ strokesToAdd, 
    int languageId
)
public ContextNode AddStrokes(
    Strokes strokesToAdd,
    int languageId
)
public function AddStrokes(
    strokesToAdd : Strokes, 
    languageId : int
) : ContextNode

パラメータ

  • languageId
    型 : System.Int32
    strokesToAdd コレクションのストロークに割り当てる言語識別子。

戻り値

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

解説

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

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

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

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

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

  • Ink.InkAdded イベント ハンドラ theInk_InkAdded2 を theInk. に結合します。

  • theInk からストローク データを分析できる新しい InkAnalyzer、theInkAnalyzer を初期化します。

' Create the Ink for use with the InkCollector and attach
' event handlers.
Me.theInk = New Microsoft.Ink.Ink()
AddHandler Me.theInk.InkAdded, AddressOf theInk_InkAdded

' Create the InkAnalyzer.
Me.theInkAnalyzer = New Microsoft.Ink.InkAnalyzer(Me.theInk, Me)
// Create the Ink for use with the InkCollector and attach
// event handlers.
this.theInk = new Microsoft.Ink.Ink();
this.theInk.InkAdded +=
    new Microsoft.Ink.StrokesEventHandler(theInk_InkAdded);

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

この例では、次に theInk_InkAdded2 イベント ハンドラが、theInk に追加されているストロークを受け取り、それを theInkAnalyzer に追加し、そのストロークに特定のロケール識別子 theLanguageId を割り当てます。

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

    ' This event handler is attached to an Ink object.
    Dim theInk As Microsoft.Ink.Ink = DirectCast(sender, Microsoft.Ink.Ink)

    ' Add the new strokes to the InkAnalyzer using a specific language identifier.
    Me.theInkAnalyzer.AddStrokes( _
        theInk.CreateStrokes(e.StrokeIds), Me.theLanguageId)
End Sub 'theInk_InkAdded2
/// <summary>
/// The ink's InkAdded event handler.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The event data.</param>
void theInk_InkAdded2(object sender, Microsoft.Ink.StrokesEventArgs e)
{
    // This event handler is attached to an Ink object.
    Microsoft.Ink.Ink theInk = sender as Microsoft.Ink.Ink;

    // Add the new strokes to the InkAnalyzer using a specific
    // language identifier.
    this.theInkAnalyzer.AddStrokes(
        theInk.CreateStrokes(e.StrokeIds), this.theLanguageId);
}

プラットフォーム

Windows Vista

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

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

InkAnalyzer クラス

InkAnalyzer メンバ

AddStrokes オーバーロード

Microsoft.Ink 名前空間

InkAnalyzer.AddStroke

InkAnalyzer.RemoveStroke

InkAnalyzer.RemoveStrokes