共用方式為


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 會將 Strokes 加入至 RootNode 屬性之 SubNodes 集合中的 UnclassifiedInkNodeStrokes (strokesToAdd) 集合中的每個筆劃都會收到指派的地區設定識別項 languageId,並且加入至包含相同地區設定識別項之筆劃的 UnclassifiedInkNode。如果沒有這類 UnclassifiedInkNode,則會建立新的 UnclassifiedInkNode 並會將 strokeToAdd 加入至新 UnclassifiedInkNode

這個方法會將 DirtyRegion 擴充至區域目前值和所加入筆劃週框的聯集。

如果任何筆劃已附加至 InkAnalyzer,則 InkAnalyzer 會擲回例外狀況。

範例

這個範例會執行下列操作:

  • 初始化新的 Microsoft.Ink.Ink 物件 (theInk.)。

  • Ink.InkAdded 事件處理常式 (theInk_InkAdded2) 附加至 theInk.。

  • 初始化名為 theInkAnalyzer 的新 InkAnalyzer,分析來自 theInk 的筆劃資料。

' 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