InkAnalyzer 构造函数 (Dispatcher)

使用特定的 Dispatcher 对象(此对象用于同步后台分析事件)初始化 InkAnalyzer 类的新实例。

命名空间:  System.Windows.Ink
程序集:  IAWinFX(在 IAWinFX.dll 中)

语法

声明
Public Sub New ( _
    synchronizingObject As Dispatcher _
)
用法
Dim synchronizingObject As Dispatcher

Dim instance As New InkAnalyzer(synchronizingObject)
public InkAnalyzer(
    Dispatcher synchronizingObject
)
public:
InkAnalyzer(
    Dispatcher^ synchronizingObject
)
public InkAnalyzer(
    Dispatcher synchronizingObject
)
public function InkAnalyzer(
    synchronizingObject : Dispatcher
)

参数

示例

下面的示例创建一个新的 InkAnalyzer,并将 StrokesChanged 事件处理程序附加到 InkCanvas(名为 theInkCanvas)上的 Strokes 属性。

theInkAnalyzer = New InkAnalyzer()

AddHandler theInkCanvas.Strokes.StrokesChanged, AddressOf Strokes_StrokesChanged
theInkAnalyzer = new InkAnalyzer();

theInkCanvas.Strokes.StrokesChanged += 
    new StrokeCollectionChangedEventHandler(Strokes_StrokesChanged);

下面的示例定义 Strokes_StrokesChanged 事件处理程序;如果笔画已添加到 theInkCanvas,该事件处理程序会将其添加到 theInkAnalyzer 中。如果笔画已从 theInkCanvas 中移除,该事件处理程序也会将其从 theInkAnalyzer 中移除。

' This event occurs whenever a stroke is added, removed, or partially erased
' from the InkCanvas.
Sub Strokes_StrokesChanged(ByVal sender As Object, ByVal e As StrokeCollectionChangedEventArgs) 
    If e.Added.Count > 0 Then
        theInkAnalyzer.AddStrokes(e.Added)
    End If

    If e.Removed.Count > 0 Then
        theInkAnalyzer.RemoveStrokes(e.Removed)
    End If

End Sub 'Strokes_StrokesChanged
// This event occurs whenever a stroke is added, removed, or partially erased
// from the InkCanvas.
void Strokes_StrokesChanged(object sender, StrokeCollectionChangedEventArgs e)
{
    if (e.Added.Count > 0)
    {
        theInkAnalyzer.AddStrokes(e.Added);
    }

    if (e.Removed.Count > 0)
    {
        theInkAnalyzer.RemoveStrokes(e.Removed);
    }
}

平台

Windows Vista

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

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

InkAnalyzer 类

InkAnalyzer 成员

InkAnalyzer 重载

System.Windows.Ink 命名空间

Ink