The Forms Namespace

The System.Windows.Forms namespace is a grouping of classes that comprise the Windows Forms technology. The classes in this namespace provide the ability to create Windows applications, which conform to the standard user interface offered by the Windows operating systems.

The classes contained in the Forms namespace can be grouped into several broad categories.

The Control Class

The System.Windows.Forms.Control class is the base class for all the controls used on a Windows Form. A control is a component that has a visual representation at runtime.

The Control class supplies the basic functionality used by all controls. This basic functionality includes methods, properties, and events to cover:

  • User interaction via keyboard and mouse

  • Receiving and losing focus

  • Size and location

  • Appearance (color, backgrounds, etc.)

  • Parent-child relationships

  • Message routing

  • Window handle (hWnd)

  • Asynchronous processing

  • Security

  • Accessibility—making the application usable to everyone, including people with disabilities

Ambient properties

Controls enter into a parent-child relationship on the form. The parent acts as a container for the child control. This relationship should not be confused with the base/derived (generalization/specialization) relationship. For example, a panel may act as a parent control to a button and a listbox, even though button and listbox do not derive from a panel.

Some Control class properties, such as Cursor, Font, BackColor and ForeColor, if not explicitly set for a ...

Get Programming .NET Windows Applications 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.