InkAnalyzer.Activity 事件

在调用 AnalyzeBackgroundAnalyze 方法的过程中发生。

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

语法

声明
Public Event Activity As ActivityEventHandler
用法
Dim instance As InkAnalyzer
Dim handler As ActivityEventHandler

AddHandler instance.Activity, handler
public event ActivityEventHandler Activity
public:
 event ActivityEventHandler^ Activity {
    void add (ActivityEventHandler^ value);
    void remove (ActivityEventHandler^ value);
}
/** @event */
public void add_Activity (ActivityEventHandler value)
/** @event */
public void remove_Activity (ActivityEventHandler value)
JScript 不支持事件。

备注

此事件指示墨迹分析器正在执行墨迹分析。此事件不指示墨迹分析器在此任务中的进度。

请在以下情况下处理此事件。

  • 向用户指示活动。

  • 在同步分析过程中处理用户输入。

  • 接收系统请求的通知,如重新绘制应用程序的窗口。

在墨迹分析的布局分析阶段以及书写和绘制分类阶段中,墨迹分析器常常引发此事件。在手写识别阶段中,墨迹分析器在访问墨迹识别器之前和之后引发此事件。

墨迹分析器生成的活动事件数受以下因素影响。

  • 墨迹分析器应用于墨迹识别的墨迹识别器。

  • 墨迹分析器正在分析的笔画的数量和长度。

  • 分类为书写的笔画数。

有关将应用程序数据与 InkAnalyzer 同步的更多信息,请参见Data Proxy with Ink Analysis

示例

此示例为墨迹分析器的 Activity 事件定义事件处理程序。如果应当取消分析操作,则该事件处理程序对生成该事件的 InkAnalyzer 调用 Abort,并更新分析器的 DirtyRegion 属性。

''' <summary>
''' The ink analyzer's Activity event handler.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The event data.</param>
Sub theInkAnalyzer_Activity(ByVal sender As Object, ByVal e As EventArgs)
    Dim abortAnalysis As Boolean = False

    ' Check if the analysis operation should be canceled.
    ' Abort analysis if the flag to do so is set.
    If abortAnalysis Then
        ' Get the InkAnalyzer that raised the Activity event.
        Dim theInkAnalyzer As Microsoft.Ink.InkAnalyzer = _
            DirectCast(sender, Microsoft.Ink.InkAnalyzer)

        ' Abort the analysis and get the region that was being analyzed.
        Dim theAnalysisRegion As Microsoft.Ink.AnalysisRegion = _
            theInkAnalyzer.Abort()

        ' Add the region that was being analyzed to the analyzer's dirty region.
        theInkAnalyzer.DirtyRegion.Union(theAnalysisRegion)
    End If

End Sub 'theInkAnalyzer_Activity
/// <summary>
/// The ink analyzer's Activity event handler.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The event data.</param>
void theInkAnalyzer_Activity(object sender, EventArgs e)
{
    bool abortAnalysis = false;

    // Check if the analysis operation should be canceled.

    // Abort analysis if the flag to do so is set.
    if (abortAnalysis)
    {
        // Get the InkAnalyzer that raised the Activity event.
        Microsoft.Ink.InkAnalyzer theInkAnalyzer =
            sender as Microsoft.Ink.InkAnalyzer;

        // Abort the analysis and get the region that was being analyzed.
        Microsoft.Ink.AnalysisRegion theAnalysisRegion = theInkAnalyzer.Abort();

        // Add the region that was being analyzed to the analyzer's dirty region.
        theInkAnalyzer.DirtyRegion.Union(theAnalysisRegion);
    }
}

平台

Windows Vista

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

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

InkAnalyzer 类

InkAnalyzer 成员

Microsoft.Ink 命名空间