COP4226, Homework 1
Due Friday, October 12 (not late until 6am 10/13)
Zip your entire project and upload on the web. Exclude the
Debug and Release directories.
Submitting
Homework Online.
Be sure to include your control library in your uploaded file.
Create a Multiple Document Interface application.
Avoid long methods. Each method that you create should be short, to promote
encapsulation. If you have a method that is longer than 25 lines, then it
probably needs to be divided into smaller methods.
Do not create a new data structure if one that already exists will
solve the problem.
Settings
Add to the project settings. In the program, use
properties to encapsulate the settings.
- Create an integer user setting that will contain the width of a wide
child.
- Create an integer user setting that will contain the height of a tall
child.
- Create an integer application setting that will contain the minimum value for the range of values for the width and height.
- Create an integer application setting that will contain the maximum value for the range of values for the width and height.
Resources
Add to the project resources.
- Use the resource editor to create an icon.
- The icon will be used in a notify icon, described later.
- The icon in the system tray is the 32x32 icon.
- Create the icon so that it looks line your initials. Use the transparent
color to hide portions of the icon that are not your initials.
- Add an image of your choice to the resources.
Control Library
Add a control library to the solution. Only add one control library:
it will contain three controls and two forms.
Interfaces
Use interfaces to encapsulate implementation details. Design code so that the implementation details of data could be changed in the future without having to rewrite all the code that accesses that data.
Oath Dialog
Create a dialog in the main application that will display the pledge of honesty.
- Use the image resource as the background image.
- Extend from the base dialog in the control library.
- Add the oath control. Center it in the remaining space.
- The dialog should be a fixed size. Remove the icon, minimize button and maximize button.
About Dialog
Create a dialog in the main application that will display a description of the assignment.
- Use the image resource as the background image.
- Extend from the base dialog in the control library.
- Add a description of the assignment. Center it in the remaining space.
- The dialog should be a fixed size. Remove the icon, minimize button and maximize button.
Preferences Dialog
Create a dialog in the main application that will be used to gather information from the user.
- Extend the base dialog from the control library.
- Set the default, background image of the form to an image that is only
added to this dialog's resources, not to the project resources
- Display the help icon button in the title bar of the dialog.
- The user interface should allow the user to enter the width and height of child forms.
Add OK, Cancel and Apply buttons. Set the default buttons for the
dialog.
- Perform thorough validation. Allow focus change. The minimum and maximum values for the valid range should be passed to the dialog in the constructor.
- Allow the form to be resized. No matter what the size is, none of the controls should ever disappear.
- Add the labels and text boxes to a panel that is just large enough to contain them. Add padding to the panel to improve appearance. The panel should be centered horizontally in the form. It should remain centered when the form is
resized. The panel should have a different color from the rest of the dialog.
- Add tool tips, error providers and help info for each input box and button. For the width and height text boxes, set the help string and tool top at run time, so they can include the range of valid numbers.
- Anchor the OK, Apply and Cancel buttons so that they remain in the lower right
area of the form when the form is resized.
- When using an interface, it is better to encapsulate actual properties in the dialog or components than to create additional variables.
- The dialog may not access any members from the main form, application settings or user settings.
Login Dialog
Display a message box before the application is run.
- Before the application is run, display a warning message box with the
buttons Yes and No. Make up a creative warning for users that are about to
run your code.
- If the user selects Yes, then proceed to run the application. If the user
selects No, then do not call Application.Run.
Tall Child
Add a form in the main application that extends the moveable base form.
- Create a constructor that has an integer parameter.
- Remove the frame from the form.
- Define the shape of the form as an ellipse. The height of the form should be value of the integer parameter. The width should be half the integer parameter.
- Set the menu in the base form so that it will merge with any other menu item with the name Preferences.
Wide Child
Add a form in the main application that extends the moveable base form.
- Create a constructor that has an integer parameter.
- Remove the frame from the form.
- Define the shape of the form as an ellipse. The width of the form should be value of the integer parameter. The height should be half the integer parameter.
- Set the menu in the base form so that it will merge with any other menu item with the name Preferences.
Main Form
Modify the main form for the project.
- Create properties tied to the user and application settings.
- Create a context menu with the following options for the preferences dialog. Only allow one preferences dialog to be open at a time. This is a normal dialog, not a MDI child. When constructing the dialog, pass the minimum and maximum values for the valid range of numbers for the width and the height. Properties are not needed for these, since the values are not changed by the dialog.
- Open Preferences Modally - open the preferences dialog as a
modal dialog. Be sure that its resources are released when you
are done with it.
- Before the dialog is shown, the main form should update the properties for the
width and height.
- If the user selects OK and closes the dialog, then the main form
should retrieve the width and height values from the
dialog. Hide the Apply buton when opened modally.
- Open Preferences Modelessly - open the preferences dialog as a
modeless dialog. Be sure that its resources are released when
you are done with it.
- Before the dialog is shown, the main form should update the properties for the
width and height.
- If the user selects OK or Apply, then the main form should
retrieve the width and height from the dialog. On OK, close the dialog. Do not close the
dialog on Apply.
- If the user selects Cancel, ESC, Alt-F4, X button, revert to the
orignal values when the dialog was opened.
- Save Preferences - save the user settings
- Reload Preferences - reload the user settings.
Repopulate the panel
(described below).
- Reset Preferences - reset the user settings.
Repopulate the panel
(described below).
- Add a status bar. Add a label to the status bar.
- Add a menu to the form.
- Add a top level menu named File.
- Add an item for opening a wide child. Send the value of the width value from the preferences to the constructor. When focus is on a wide child, show the word WIDE in the status bar along with the current background color of the child. Update the status bar when the color changes, too.
- Add an item for opening a tall child. Send the value of the height
width value from the preferences to the constructor. When focus is on a tall child, show the word TALL in the status bar along with the current background color of the child. Update the status bar when the color changes, too.
- Add an item for closing the application.
- Add a top level menu named Help.
- Add a menu Oath to the Help menu.
- When clicked, display a new modeless form.
- Only allow one Oath dialog to be open at one time.
- Position the Oath dialog to the right of main
window: the right border of the main window should abut
the left border of the new window; the tops of the windows
should be at the same height from the top of the screen.
- Make this an owned form.
- Add a menu item named About to the Help menu.
- When clicked, display a new modal form.
- Position the window below the main window: the bottom border
of the main window should abut the top border of the new
window; the left borders of the windows should be at the same
distance from the left edge of the screen.
- Add an item to the main menu, named Preferences, whose drop down is the context menu created above. Do not duplicate the items in the context menu, make the drop down of the new item the same as the context menu. Refer to the additional lecture notes on the class page for Inherited Menus
Add an item to the main menu for tiling and cascading the open child forms.
- Add a notify icon.
- Use your icon with your initials for the icon. Add the icon in code, so you can access the resources, instead of locating it in the file system.
- Use your context menu for it.
- When the form is deactivated, make the form partially transparent. When
the form is activated, make the form opaque.
- When the form closes, ask the user if they really want to close the
application. Only close the application if the user confirms.
Screen shot with open dialogs: Screen Shot