次の方法で共有


InkAnalyzer.AddStroke メソッド (Stroke, Int32)

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

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

構文

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

returnValue = instance.AddStroke(strokeToAdd, _
    languageId)
public ContextNode AddStroke(
    Stroke strokeToAdd,
    int languageId
)
public:
ContextNode^ AddStroke(
    Stroke^ strokeToAdd, 
    int languageId
)
public ContextNode AddStroke(
    Stroke strokeToAdd,
    int languageId
)
public function AddStroke(
    strokeToAdd : Stroke, 
    languageId : int
) : ContextNode

パラメータ

  • languageId
    型 : System.Int32
    strokeToAdd に割り当てるロケール識別子。

戻り値

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

解説

InkAnalyzer は、StrokeRootNode プロパティの SubNodes コレクション内の UnclassifiedInkNode に追加します。Stroke、strokeToAdd にロケール識別子 languageId を割り当て、同じロケール識別子のストロークを格納する最初の 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 に追加し、そのストロークに特定のロケール識別子 theLanguageId を割り当てます。

''' <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_Stroke2( _
    ByVal sender As Object, ByVal e As Microsoft.Ink.InkCollectorStrokeEventArgs)

    ' Add the new stroke to the InkAnalyzer using a specific language identifier.
    Me.theInkAnalyzer.AddStroke(e.Stroke, Me.theLanguageId)

End Sub 'theInkCollector_Stroke2
/// <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_Stroke2(
    object sender, Microsoft.Ink.InkCollectorStrokeEventArgs e)
{
    // Add the new stroke to the InkAnalyzer using a specific
    // language identifier.
    this.theInkAnalyzer.AddStroke(e.Stroke, this.theLanguageId);
}

プラットフォーム

Windows Vista

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

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

InkAnalyzer クラス

InkAnalyzer メンバ

AddStroke オーバーロード

Microsoft.Ink 名前空間

InkAnalyzer.AddStrokes

InkAnalyzer.RemoveStroke

InkAnalyzer.RemoveStrokes