InkAnalyzer.AddStrokes 方法 (Strokes)

InkAnalyzer 添加笔画集合,并为每个笔画分配活动输入线程的区域设置标识符。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink.Analysis(在 Microsoft.Ink.Analysis.dll 中)

语法

声明
Public Function AddStrokes ( _
    strokesToAdd As Strokes _
) As ContextNode
用法
Dim instance As InkAnalyzer
Dim strokesToAdd As Strokes
Dim returnValue As ContextNode

returnValue = instance.AddStrokes(strokesToAdd)
public ContextNode AddStrokes(
    Strokes strokesToAdd
)
public:
ContextNode^ AddStrokes(
    Strokes^ strokesToAdd
)
public ContextNode AddStrokes(
    Strokes strokesToAdd
)
public function AddStrokes(
    strokesToAdd : Strokes
) : ContextNode

参数

返回值

类型:Microsoft.Ink.ContextNode
已添加 strokesToAdd 的 ContextNode

备注

InkAnalyzerStrokes 添加到 RootNode 属性的 SubNodes 集合中的一个 UnclassifiedInkNodeStrokes 集合 strokesToAdd 中的每个笔画都被分配活动输入线程的区域设置标识符,并添加到包含具有相同区域设置标识符的笔画的第一个 UnclassifiedInkNode。如果不存在这样的 UnclassifiedInkNode,则新建一个 UnclassifiedInkNode,并将 strokeToAdd 添加到新的 UnclassifiedInkNode 中。

此方法将 DirtyRegion 扩展为区域的当前值与所添加笔画的边界框的并集。

如果这些笔画中有任何笔画已经附加到 InkAnalyzer,则 InkAnalyzer 将引发异常。

示例

此示例执行以下操作。

  • 初始化新的 Microsoft.Ink.Ink 对象 theInk。

  • Ink.InkAdded 事件处理程序 theInk_InkAdded 附加到 theInk。

  • 初始化新的 InkAnalyzer (theInkAnalyzer),它可以分析来自 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_InkAdded 事件处理程序随后获取已添加到 theInk 的笔画,并将这些笔画添加到 theInkAnalyzer。

''' <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_InkAdded( _
    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.
    Me.theInkAnalyzer.AddStrokes(theInk.CreateStrokes(e.StrokeIds))

End Sub 'theInk_InkAdded
/// <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_InkAdded(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.
    this.theInkAnalyzer.AddStrokes(theInk.CreateStrokes(e.StrokeIds));
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

InkAnalyzer 类

InkAnalyzer 成员

AddStrokes 重载

Microsoft.Ink 命名空间

InkAnalyzer.AddStroke

InkAnalyzer.RemoveStroke

InkAnalyzer.RemoveStrokes