ActivityEventHandler 委托

表示将处理 InkAnalyzerActivity 事件的方法。

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

语法

声明
Public Delegate Sub ActivityEventHandler ( _
    sender As Object, _
    e As EventArgs _
)
用法
Dim instance As New ActivityEventHandler(AddressOf HandlerMethod)
public delegate void ActivityEventHandler(
    Object sender,
    EventArgs e
)
public delegate void ActivityEventHandler(
    Object^ sender, 
    EventArgs^ e
)
/** @delegate */
public delegate void ActivityEventHandler(
    Object sender,
    EventArgs e
)
JScript 不支持委托。

参数

备注

创建 ActivityEventHandler 委托时,需要标识将处理该事件的方法。若要将该事件与事件处理程序关联,请将该委托的一个实例添加到事件中。除非移除了该委托,否则每当发生该事件时就会调用此事件处理程序。有关事件处理程序委托的更多信息,请参见 Events and Delegates(事件和委托)。

示例

此示例为墨迹分析器的 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

另请参见

参考

Microsoft.Ink 命名空间