InkAnalyzer 构造函数

初始化与指定的 Microsoft.Ink.Ink 对象相关联的 InkAnalyzer 类的新实例。

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

语法

声明
Public Sub New ( _
    ink As Ink, _
    synchronizingObject As ISynchronizeInvoke _
)
用法
Dim ink As Ink
Dim synchronizingObject As ISynchronizeInvoke

Dim instance As New InkAnalyzer(ink, synchronizingObject)
public InkAnalyzer(
    Ink ink,
    ISynchronizeInvoke synchronizingObject
)
public:
InkAnalyzer(
    Ink^ ink, 
    ISynchronizeInvoke^ synchronizingObject
)
public InkAnalyzer(
    Ink ink,
    ISynchronizeInvoke synchronizingObject
)
public function InkAnalyzer(
    ink : Ink, 
    synchronizingObject : ISynchronizeInvoke
)

参数

备注

InkAnalyzer 只能分析来自一个 Ink 对象的笔画数据。不能在初始化墨迹分析器之后更改此关联。

如果为 synchronizingObject 传入 null 值,则在处理由 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 成员

Microsoft.Ink 命名空间

Microsoft.Ink.Ink