InkAnalyzer.AddStroke 方法 (Stroke)

Stroke 添加到 InkAnalyzer,并为该笔画分配活动输入线程的区域设置标识符。

命名空间:  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

备注

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

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

如果该笔画已经附加到 InkAnalyzer,则 InkAnalyzer 将引发异常。

示例

此示例执行以下操作。

' 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