-
Book Overview & Buying
-
Table Of Contents
Microsoft Visual C++ Windows Applications by Example
By :
This chapter presents a simple Windows application, with the purpose of introducing the features of MFC. When the user clicks the left mouse button, a ring is drawn. The user can choose the color of the next ring as well as save and load the set of rings. We will start by creating the framework with the help of the Application Wizard, and then add application specific code.

We store the colors and positions of the ring in an array. There is a predefined type COLORREF holding a color.
When the user presses or releases the mouse, messages are sent tothe application. We use the Class Wizard to create methods that detectthe messages.
We can paint the rings by overriding the Draw method and using the methods of the Device Context.
The paint area may not fit into the window. We can add scroll bars and define the size of the underlying canvas.
As well as detecting mouse clicks, we can also write methods that detect when the user presses a keyboard key.
In order...
Change the font size
Change margin width
Change background colour