8.3. Windows forms and events
Windows forms applications are event-based. This means that each user or system action, such as pressing a button, selecting an item in a list box, or repainting a window or its area causes an event. In order to intercept these events, we create event handlers – subroutines that contain pieces of code that are executed when the particular events occur. All Windows forms events are based on a feature of the common language runtime called “delegates”. We can think of delegates as type-safe, secure function pointers. For more information on events and delegates, see Chapter 3.
Each event defined in the Control class has an event delegate with a signature that looks like EventName EventHandler. For example, the Click ...
Get A Programmer's Guide to .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.