Windows Forms Application Model

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

Windows Forms Application Model

Rating:

The application-programming model for Windows Forms basically consists of forms, controls and their events. The following are the three facets of the Windows Forms application model:

  • Forms: In the context of Windows Forms, the term "form" can be referred to as any application's main window. Even dialog boxes can also be considered as forms. Therefore, the Form class in Windows Forms represents a window that is displayed in an application. The BorderStyle property of the Form class can be used to create standard, tool, borderless, and floating windows. The Form class can also be used to create modal windows such as dialog boxes to perform specific tasks.

    The MDI form that is a special kind of form of the Form class can be created within the Windows Forms application by setting the MDIContainer property of the Form class. An important feature of an MDI form is that it can contain other forms called as the MDI child forms. The Form class also provides other features such as scrolling of the contents within the form window and keyboard handling such as tab order. While designing user interface for an application, a class is created that is derived from the Form class. The user can then add various controls, set properties, create event handlers, and also can add programming logic to the form.


  • Controls: A component is typically a .NET Framework class that supports the design-time experience in Windows Forms but does not provide for user interface in a container-specified region of a form. The components implement the System.ComponentModel.IComponent interface and are derived from the System.ComponentModel.Component base class. However, the controls in Windows Forms provide the user interfaces within the visual area of a form. All controls are generally derived from the System.Windows.Forms.Control class that indirectly derives from the Component base class. Therefore, a control is in fact a component with a user interface in the context of Windows Forms.

    Visual Studio .NET provides some built-in controls such as a Button, a RadioButton, or a TextBox control, and custom controls such as Windows Forms DataGrid. The user can interact with several controls by setting their properties to alter their appearance and behavior.


  • Events: An event is an object that describes the change of state of a source. It is generated by direct or indirect interaction with a user interface. For example, an event occurs directly when a user presses a button, enters a character, clicks the mouse, etc. Similarly, an event occurs indirectly by the system or by program code. For example, when a timer expires or a counter exceeds a given value. All event-driven applications usually execute the program code in response to the event that has occurred. A Windows Form is an event-based application model. When a control changes its state such as when a user clicks a button or presses a key from the keyboard, it raises an event. For this purpose, the application registers an event-handling method for that event.

    An event handler is a course of action in program code that is performed when an event occurs. Therefore, when an event is raised, the code within the event handler is executed. In order to handle an event, the event handler provides two parameters. The first parameter passes a reference to the object that raised the event, and the second parameter passes an object specific to the event that is being handled by the event handler.


Rating:



Other articles

Click here to Article home

 
uCertify.com | Our Company | Articles | Privacy | Security | Contact Us | News and Press Release | uCertify India
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.