Chapter 11: An Introduction to Windows Forms

Part III
Programming Windows Forms
Chapter 11
An Introduction to Windows Forms
  • Understanding Windows Forms
  • Developing a Simple Windows Forms Project
  • Displaying Information with Message Boxes
  • Controlling a Windows Forms Application
  • Using Form Properties to Affect Form Behavior

In this chapter, you’ll learn about Windows Forms, the classes within the Microsoft .NET Framework that are used to create traditional Microsoft Windows GUI desktop applications. The key class in the System.Windows.Forms namespace is Form, the base class used for most windows in a Windows Forms application. The Form class serves as a base class for all top-level windows, including your application’s main window, view windows, and any dialog boxes that you create. This chapter introduces you to the Form class, as well as to three other key classes in the System.Windows.Forms namespace:

  • Application  Used to manage application-level characteristics of your program

  • ApplicationContext  Used to manage the behavior of an application, such as how it is launched and closed

  • MessageBox  Used to display simple dialog boxes known to the user as message boxes

In addition, this chapter discusses many of the commonly used properties and methods associated with the Form, Application, and MessageBox classes.

In this chapter, we’ll also look at the Microsoft Visual C# Forms Designer and examine the source code generated by the Forms Designer that’s injected into your source code. The forms and controls included in the .NET Framework expose a wide variety of properties that affect every aspect of forms and controls’ behavior. The Forms Designer provides a visual interface to those properties. As you manipulate controls visually and set properties in the Properties window, the Forms Designer serializes the required properties directly into your source code.

This chapter focuses on the core classes used for programming Windows Forms applications. Subsequent chapters in Part III will expand on that programming, describing the controls that are available to you, how to collect user input, and other advanced programming techniques.

Part III: Programming Windows Forms