Поделиться через


ActivityEventHandler - делегат

Обновлен: Ноябрь 2007

Represents the method that will handle the Activity event of an InkAnalyzer.

Пространство имен:  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 не поддерживает делегаты.

Параметры

Заметки

When you create an ActivityEventHandler delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event-handler delegates, see Events and Delegates.

Примеры

This example defines an event handler for the ink analyzer's Activity event. If the analysis operation should be canceled, the event handler calls Abort on the InkAnalyzer that generated the event and updates the analyzer's DirtyRegion property.

''' <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 - пространство имен