Web hosting colocation - CHAPTER 19 BUILDING A BETTER WINDOW WITH

CHAPTER 19 BUILDING A BETTER WINDOW WITH SYSTEM.WINDOWS.FORMS 611 The System.EventHandler Delegate Notice that the ApplicationExit event works in conjunction with the System.EventHandler delegate. This delegate must point to methods that conform to the following signature: delegate void EventHandler(object sender, EventArgs e); System.EventHandler is the most primitive delegate used to handle events within Windows Forms, but many variations do exist for other events. As far as EventHandler is concerned, the first parameter of the assigned method is of type System.Object, which represents the object sending the event. The second EventArgs parameter (or a descendent thereof) contains any relevant information regarding the current event. Note EventArgs is the base class to numerous derived types that contain information for a family of related events. For example, mouse events work with the MouseEventArgs parameter, which contains details such as the (x, y) position of the cursor. Many keyboard events work with the KeyEventArgs type, which contains details regarding the current keypress, and so forth. In any case, if you now recompile and run the application, you will find your message box appear upon the termination of the application. Source Code The AppClassExample project can be found under the Chapter 19 subdirectory. The Anatomy of a Form Now that you understand the role of the Application type, the next task is to examine the functionality of the Form class itself. Not surprisingly, the Form class inherits a great deal of functionality from its parent classes. Figure 19-3 shows the inheritance chain (including the set of implemented interfaces) of a Form-derived type using the Visual Studio 2005 Object Browser. Figure 19-3. The derivation of the Form type
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

Leave a Reply