-
Book Overview & Buying
-
Table Of Contents
Microsoft Visual C++ Windows Applications by Example
By :
In this chapter, we will deal with a drawing program. It is capable of drawing lines, arrows, rectangles, and ellipses. It is also capable of writing and editing text, cut-and-paste figures as well as saving and loading the drawings. The following screenshot depicts a classic example of the Draw Application:

We start by generating the application's skeleton code with the Application Wizard. The process is similar to the Ring application code.
The figures are represented by a class hierarchy. The root class is Figure. It is abstract and has a set of pure virtual methods that are to be defined by its sub classes. It has one abstract sub class TwoDimensionalFigure.
There are five concrete sub classes in the hierarchy: LineFigure, ArrowFigure, RectangleFigure, EllipseFigure, and TextFigure. There is also the class FigureFileManager that handles the file management of the figures.
The document class manages the data of the drawing. It has a list to keep track of the...
Change the font size
Change margin width
Change background colour