共用方式為


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 委派 (Delegate) 時,您會識別處理事件的方法。若要使事件與您的事件處理常式產生關聯,請將委派的執行個體 (Instance) 加入至事件。除非您移除委派,否則每當事件發生時就會呼叫事件處理常式。如需事件處理常式委派的詳細資訊,請參閱事件和委派 (英文)。

範例

這個範例會定義筆墨分析器之 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 命名空間