What Is a WinForm?

Simply, a WinForm is analogous to a Visual Basic (VB) 6 .FRM form module. On the exterior, both types of forms operate in a similar fashion, look the same, and are used as containers to display controls. Internally, however, they are very different.

You create a WinForm from the Form class within the .NET framework. This class exists in the System.WinForms namespace, which is contained within the System.Winforms.DLL file. The Form class inherits from several other classes. The following listing shows the class hierarchy for the Form class:

Object
MarshalByRefObject
MarshalByRefComponent
Control
RichControl
ScrollableControl
ContainerControl
Form

The Object class is the ultimate base class of the Form class, as well as all other classes contained in the .NET framework. A brief description of each class follows:

Object

The base class of every object in the .NET framework.

MarshalByRefObject

Contains base implementation for use by objects that need remoting ability.

MarshalByRefComponent

Contains base implementation for use by all controls that can be sited on a form.

Control

Contains base implementation for use by all objects that have a user interface. This class handles keyboard and mouse input, as well as message routing and security. This class is central to subclassing.

RichControl

Extends the Control class by adding the ability to paint itself, to control context menus, and to handle docking and anchoring of its window.

ScrollableControl

Adds the ability for a window ...

Get Subclassing and Hooking with Visual Basic 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.