Overview

There are slight differences in the syntax of event handlers between C++ and Visual Basic on one side, and C# on the other.

 

In C#

The event handler always has a sender parameter, which is the object that is sending the event.

The event’s parameters are always properties in the EventArguments (second parameter) of the event handlers.

Many event handlers offer a "continue" parameter. Since in C# continue is a reserved keyword, one needs to preceded it with a "@" sign, to tell the compiler that what follows should be treated literally and not interpreted.

Below is a code sample for the SavePage event:

 

Example

public void pdf_SavePageEvent(object sender, AxACPDFCREACTIVEX._IPDFCreactiveXEvents_SavePageEvent e)
{
    if (e.pageNumber < 5)
        e.@continue = 1;
    else
        e.@continue = 0;
}

 

 

In C++ and VB

There is no sender parameter.

Event arguments are explicit parameters to the event handler.

Below is a sample of a C++ event handler for the PrintPage Event.

 

Example

void CMFCDialogAppDlg::PrintPagePdfcreactivex1(long PageNumber, long* Continue)
{
    if (PageNumber < 5)
        *Continue = 1l;
    else
        *Continue = 0l;
}