Reusing the .NET Framework Class Library with Inheritance

Many of the classes in the .NET Framework class library have been designed to be base classes from which we are meant to derive new classes in our code. The System.Windows.Forms.Form (from now on simply referred to as Form) class is a core class for writing Windows GUI applications in .NET. Anybody who wants to write Windows GUI applications must derive classes from this base class.

Listing 16.7 demonstrates how easy it is to draw a window similar to that shown in the sample output after the listing by deriving a class from the Form class. Even though the displayed window looks a bit empty, it nevertheless has all the capabilities that we have come to expect from a standard window. For ...

Get C# Primer Plus 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.