COP4226, Assignment 2
Due Monday, October 23, at 11:59 PM.
Zip your entire project and upload it on the web. Exclude all of the
Debug and Release directories.
Submitting
Homework Online.
This is an extension of HW1. Fix any errors that you had in HW1.
-
Add File and View menus to the main menu.
-
Under the File drop down, add Exit.
-
Under the View drop down, add Display, Close Displays, Colors, and Hatching.
-
Colors will have a submenu of Background and Foreground.
-
Add a notify icon.
-
Add a context menu with the options of Tile, Cascade, Close Displays, and
Exit. Place a separator between Close Displays and Exit.
-
Implement context sensitive help for all controls on the main form: input,
output, buttons. Enable context sensitive help so that the question mark
appears in the title bar. In order for help to work, the control must be
enabled. This may cause you to reimplement the output box.
-
In addition to validating input when the operation button is clicked, do
error validation when the menu item View Display is clicked and when the
Display button is clicked.
-
Do not open the dialog if there is an error.
-
Validate that all the fields are correct.
-
When the delegate for the display dialog is fired (explained below), initialize
the main form with the data and settings from the display dialog.
-
Display the ID from the display dialog in the title bar of the main form,
along with the name of the application.
-
Update the radio buttons, drop down list, input boxes and values according
to the data from the dialog.
-
Change the background and foreground colors of the main form to the foreground
and background colors of the dialog that fired the delegate.
-
Save the current hatching from the dialog and use it when creating new display
dialogs.
Display Dialog
-
Create a new form that will display the current values and settings from
the main form.
-
Use the current foreground and background colors of the main form as the
foreground and background colors of the dialog.
-
Use the current hatching to draw the background of the dialog.
-
Create properties that can be used to access the data in the dialog.
-
Display the Category, Operation, and Input.
-
For the given operation, display the correct number of input and correct
labels, as were displayed in the main form.
-
Add a field for an ID.
-
When the form opens, this field should have the focus.
-
When the user clicks the Apply button, validate that the ID is not empty
and is not all blanks.
-
When the focus leaves the ID field, add it to the title of the dialog. If
the ID field changes, the new ID should replace the old ID in the title.
-
Add an Apply button to the form. When the apply button is clicked, fire a
delegate.
-
Add a Cancel button to the form.
-
This form may not access any properties or methods of the main form. It should
know nothing about the main form.
-
Implement context sensitive help for this dialog.
-
Enable context sensitive help so that the question mark appears in the title
bar.
-
The help string for the input fields should include the label for the field
and the operation that is being performed.
-
Do not show this form's icon in the taskbar.
-
These forms should always display above the main form in the Z-order
-
I will refer to these dialogs as display dialogs.
Main Form Main Menu - New Options
-
All the menu options from Hw1 must still function.
-
File Exit: close the application.
-
View Display: open a display dialog modelessly. This should only be enabled when
the input box(es) for a calculation can be seen.
-
View Close Displays: close all the display dialogs that are open.
-
View Colors Background: open a color dialog and change the background color
of the main form. New display dialogs will use the current background color
of the main form. Open the dialog with the current background color selected.
-
View Colors Foreground: open a color dialog and change the foreground color
of the main form. New display dialogs will use the current foreground color
of the main form. Open the dialog with the current background color selected.
-
View Hatching: Open a modal dialog that displays all the hatching styles
in a drop down list. As the selected index changes, draw the selected hatch
in a panel in the dialog.
-
When the dialog closes, save the hatching style and use it to draw the background
of new display dialogs. Do not change the hatching of dialogs that are already open.
-
When the hatching dialog is reopened, be sure that the current hatching is
preselected in the drop down list.
-
In the panel,
-
Draw the hatching with the fore and back colors from the main form (when
the dialog was opened).
-
Draw a centered rectangle that contains the name of the hatching. Do not
use a control for this, draw the rectangle and draw the text that is in the
rectangle. Include padding around the text so that the text is easily read.
-
Create and use a font to draw the text. Do not use a font that is managed
by .NET.
-
Draw the border of the rectangle using a compound pen. Use beveled corners
for the pen.
Notify Context Menu
-
Tile: tile the open display dialogs on the desktop. Resize each display dialog
to the minimum size so that all the controls are visible. Starting in the
upper left corner place each dialog next to each other. When the first row
is full, start a new row directly below the first row. Continue in this way
until all the dialogs are arranged. If there are too many to fit on one screen,
then start over again at the upper left corner.
-
Cascade: cascade all the open display dialogs starting from the upper left
corner of the desktop. Resize each display dialog to the minimum size so
that all the controls are visible. Overlap the dialogs so that the next dialog
is located directly below the the title bar of the previous form. Offset
the next dialog to the right of the previous dialog by the height of the
title bar. If there are too many to fit on one screen, then start over again
at the upper left corner.
-
Be sure that the cascade does not cover the title bar of the main form.
-
Be sure that dialogs do not appear under the Windows taskbar.
-
Close Displays: this will perform the same action as the menu item View Close
Displays.
-
Exit: this will perform the same action as the menu File Exit.