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:

Bitmap

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.

Brush

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.

Font

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

Graphics

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

Pen

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:

ArrayConverter

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

ByteConverter

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

StringConverter

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

TypeConverter

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: 

Button

Represents a Windows button control.

CheckBox

Represents a Windows check box.

CheckedListBox

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

ColorDialog

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

ComboBox

Represents a Windows combo box control.

DataGrid

Displays ADO .NET data in a scrollable grid.

MainMenu

Represents the menu structure of a form.

MessageBox

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

TextBox

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