Advanced Windows Programming
ITC226 .. Test Week 3 : GDI And A Dialog Box In An SDI application
[Previous Test][Next Test]
You may modify the test project from last week, or create a new project:
Use AppWizard to create an MFC based SDI application. The application will have a menu
item "Add Drawing Parameters" which when selected will display a modal dialog box that
allows the user to enter a color, a string (such as a name or a description) and select a shape. The
user will be asked for
- the components of red, green and blue
(that would be entered into edit controls in the dialog box);
- the string (entered into an edit control, maximum 15 characters);
- a shape (either a rectangle or an ellipse, selected by use of radio buttons).
Ensure the user must enter numbers in the correct range to be a color component.
After the Dialog Box is ended (by clicking "OK"), the program is to display
- the shape selected using a 5-pixel
wide pen of the color specified by the components entered by the user in the modal dialog box;
- the string (entered by the user in the modal dialog box) (using TextOut) above the shape;
- the string (entered by the user in the modal dialog box) (using DrawText) inside the shape;
The CDC class has member functions "Rectangle, Ellipse, TextOut and DrawText".
The first time the dialog box is displayed, the color components will contain zero (0),
the string will be empty and the shape will be a rectangle.
Subsequent displays of the dialog box will start displaying those values of
the color components, string and selected shape from the last display of the dialog box that ended with
"OK" being clicked.
Author: Jim Geyer