CS-360, Fall, 2009
Assignment 2
Due Date: 10-2-09
In this assignment you are to use Microsoft Visual Studio 2005 or 2008 to
develop a Visual C++, MFC, Document/View, Single Document Interface Windows
application that performs most of the same functions as your first Win32 API
assignment. In addition, an extra "Rubberband Line" function will be added
and a modal dialog box will replace the standalone controls when the user
chooses to draw text. These are described below.
As in the first assignment there is to be a menu with the items: "Drawing
Function", "Pattern", "Color", "Text", "Clear", and "Quit". All but the last
three should be popup menus. When the user clicks "Drawing Function", a popup
menu with the items: "Sketch", "Polygon", and "Rubberband Line", should appear.
All but the last of these should work just as they did in your first assgnment.
The sketching should be done in exactly the same way illustrated by the "Sketch"
example MFC program discussed in class. If the user selects "Rubberband Line",
a subsequent press of the left mouse button should anchor one end of the line
to be drawn. While the left mouse button remains down, the user should be able
to move the mouse so that a line is continuously drawn from the anchor point
that stretches and contracts in such a way that the other end of the line
follows the motion of the mouse. This can be achieved if each time the mouse
moves (with the left button still down), the old line is erased (by perhaps
drawing it again with a background-colored pen) and then drawing a new line
from the anchor point to the point at which the mouse cursor was when the mouse
moved. The line should be made "permanent" when the left mouse button goes up.
The "Pattern", "Color", "Clear" and "Quit" menu items should work the same way
as in Assignment 1. The "Text" menu item should now cause a modal dialog box
entitled "Text Entry Dialog Box", similar to the one shown below, to appear.
(In the figure below the title of the dialog box is "Dialog" instead of "Text
Entry Dialog Box".) This dialog box should contain edit controls in which the
user can type the text he/she desires to be displayed as well as the (x,y)
coordinates of the point on the parent window's client area where the text should
appear. After the user clicks the "OK" button inside this dialog box to dismiss it,
the text the user entered should appear on the parent window's client area such that
the upper lefthand corner of its imaginary boundingrectangle is at the (x,y)
coordinates entered by the user. If the user clicked the dialog box's "Cancel"
button, nothing should be displayed after the dialog disappears.

As for Assignment 1, your window should have an appropriate title.
Use the "Sketch" example program discussed in class as a model for developing this MFC
Document/View application.
YOU ARE TO TURN IN A CD-ROM that contains a copy of the entire project's
directory (with all the large, unnecessary temporary files deleted). Finally,
submit with the CD a printed listing of the file containing your view class
implementation (e.g., SketchView.cpp -- the name will not necessarily be the
same as given here). The CD and program listing should be put in an envelope
with your name, the assignment number (2), and CS-360 clearly writen on
the outside, as in Assignment 1.