4. Windows Programming

In this tutorial, basic Graphical User Interface (GUI) programming using Windows Forms, Menus and Graphics Objects is covered. Sample applications such as Simple Interest and Matrix Grid will help you to familiarize with common frequently used Namespaces. Usage of various Namespaces such as System.Drawing, System.ComponentModel, System.Windows.Forms etc and Windows event handlers are illustrated in this tutorial. A brief explanation of all important Namespaces and classes are given below. Please go through MSDN for a detailed explanation about all these Namespaces and their members.


System.Drawing- The System.Drawing namespace provides access to GDI+ basic graphics functionality. The Graphics class provides methods for drawing to the display device. Classes such as Rectangle and Point encapsulate GDI+ primitives. The Pen class is used to draw lines and curves, while classes derived from the abstract class Brush are used to fill the interiors of shapes.

Some of the classes in the System.Drawing namespace are:


Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes. A Bitmap object is an object used to work with images defined by pixel data.


Classes derived from this abstract base class define objects used to fill the interiors of graphical shapes such as rectangles, ellipses, pies, polygons and paths.


Defines a particular format for text, including font face, size and style attributes. This class cannot be inherited.


Encapsulates a GDI+ drawing surface. This class cannot be inherited.


Defines an object used to draw lines and curves. This class cannot be inherited.


System.ComponentModel- The System.ComponentModel namespace provides classes that are used to implement the run-time and design-time behavior of components and controls. This namespace includes the base classes and interfaces for implementing attributes and type converters, binding to data sources and licensing components.

Some of the classes in System.ComponentModel namespace are:


Provides a type converter to convert Array objects to and from various other representations.


Provides a type converter to convert 8-bit unsigned integer objects to and from various other representations.


Provides a type converter to convert string objects to and from other representations.


Provides a unified way of converting types of values to other types, as well as for accessing standard values and subproperties.


System.Windows.Forms- The System.Windows.Forms namespace contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system. The classes in this namespace can be grouped into the following categories: Controls, Components and Common Dialog Boxes

Some of the classes in this System.Windows.Forms namespace are: 


Represents a Windows button control.


Represents a Windows check box.


Displays a ListBox in which a check box is displayed to the left of each item


Represents a common dialog box that displays available colors along with controls that allow the user to define custom colors.


Represents a Windows combo box control.


Displays ADO .NET data in a scrollable grid.


Represents the menu structure of a form.


Displays a message box that can contain text, buttons and symbols that inform and instruct the user.


Represents a Windows text box control.



Simple Interest Example in C#



Matrix Grid Example in C#



Download source code for Simple Interest Example

Download source code for Matrix Grid Example


Site optimized for IE6 and above. Copyright © 2010. Site Developed Using KTS WebCloud