Starting with a Form

Most windows are represented in WFC programming as forms. A form is used wherever you want a separate overlapping, graphical component, such as a main application window or dialog box. Forms act as containers for controls, allowing you to visually composes applications. Forms have their own properties, which can be set in the Properties dialog box. Syntactically, a form is a Java class derived from the Form class. The Form class extends the Control class, as do the controls that you place on a form.

When you create a new project, and then choose Windows Application, a form is automatically created for you. You can add other forms by choosing either Add Item or Add Form from the Project menu.

Once a form is added to your project, the form can be viewed either in the design mode or in the code editor. You can use the Designer to size it and set properties by choosing View Designer from the shortcut menu of the form in Project Explorer. Each form belongs to a nonvisual Application object that contains the main thread of the application. Forms and controls represent the visual Windows components. This is handled completely by the framework of WFC.

When you open the code editor on the a new form, you'll see the template-based class created for you that contains the necessary syntax of the form class, including a constructor and a main() method with code that instantiates your form. When you work in design mode, adding controls, setting properties, and so forth, the Designer inserts and modifies a section of this class (this area is delineated in the code editor and should not be edited by hand).

For information on creating a form see Designing Forms.