COP4226, Homework 3 - Part B
Due Monday, 9/19 (late 6 am, 9/20)
This application will use many features from Homework 3 - Part A.
Create a Multiple Document Interface application. The app will open child windows that are either ellipses,
rectangles or custom shapes. One dimension (height or width) of each will be determined by a ratio that is set by the user. The child windows can have different colors and can be moved by the mouse.
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.
Use properties to encapsulate implementation details.
Use meaningful names for all variables. Any variable that ends with a number will lose points.
Do not create a new data structure, event, property if one that already exists will
solve the problem.
Control Library
Add a project for 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.
Project Resources
- Add an image to the project resources that will be used as a background image for several dialogs.
Oath Dialog
Create a dialog in the main application that will display the oath of participation.
- 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 panel in the base dialog.
- 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 panel in the base dialog.
- The dialog should be a fixed size. Remove the icon, minimize button and maximize button.
Preferences Dialog
Create a modeless dialog in the main application that will be used to gather information from the user.
- Extend it from the base dialog in 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. Choose a small image.
- Display the help icon button in the title bar of the dialog.
- The user interface should allow the user to enter width of an elliptic child, height of a rectangular child and the ratio of the width to the height for elliptic and rectangular children. Add OK, Cancel and Apply buttons. Set the default buttons for the
dialog.
- Perform thorough validation. Allow focus change. Choose reasonable validation ranges.
- 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 new panel that is just large enough to contain them. 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. Set the help string and tool tip 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.
- Only allow one preferences dialog to be open at a time.
- This is a normal dialog, not a MDI child.
- When the form is deactivated, make the form partially transparent. When
the form is activated, make the form opaque.
- The dialog may not access any members from the main form, application settings or user settings.
Login Dialog
Display a dialog before the application is run.
- Before the application is run, display a warning dialog 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.
- Add a checkbox that allows the user to skip this screen in the future.
- Save the preference in a user setting.
- When the app is started, skip the login dialog if the preference is set.
Elliptic Child
Add a form in the main application that extends the moveable base form.
- Create a constructor that has a float parameter and an integer.
- Remove the frame from the form.
- Define the shape of the form as an ellipse. The integer parameter is the width. The height should be the width multipled by the float parameter.
- Set the menu in the base form so that it will merge with any other menu item with the name Preferences.
Rectangular Child
Add a form in the main application that extends the moveable base form.
- Create a constructor that has a float parameter and an integer.
- Remove the frame from the form.
- Define the shape of the form as a rectangle. The first parameter is the height. The width should be the height multipled by the float parameter.
- Set the menu in the base form so that it will merge with any other menu item with the name Preferences.
Custom Child
Add a form in the main application that extends the moveable base form.
- Create a constructor that has a float parameter and an integer.
- Remove the frame from the form.
- Define the shape of the form so to contains at least one ellipse and one rectangle, but it may be as complex as you like. The first parameter is the total width of the shape. The height should be the width multipled by the float 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 a context menu with the following options for the preferences 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
for the form.
- If the user selects OK and closes the dialog, then the main form
should retrieve the ellipse width, rectangle height, ellipse ratio and rectangle ratio 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
for the form.
- If the user selects OK or Apply, then the main form
should retrieve the ellipse width, rectangle height, ellipse ratio and rectangle ratio values 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.
- The dialog should never show behind the main form. Do not make it a top level form.
- Add a status bar. Add a label to the status bar.
- Add a menu to the form.
- Add shortcut keys for all menu items.
- Add a top level menu named File.
- Add an item for opening an elliptic child. Send the value of the elliptic ratio and elliptic width values from
the preferences to the constructor. When focus is on an elliptic child, show the word Ellipse in the status bar along with the current
background color of the child. Update the status bar when the color changes, too. Remember that the child may know nothing about the parent.
- Add an item for opening a rectangular child. Send the value of the height value and rectangle ratio value from
the preferences to the constructor. When focus is on a rectangular child, show the word Rectangle in the status bar along with the current
background color of the child. Update the status bar when the color changes, too. Remember that the child may know nothing about the parent.
- Add an item for opening a custom child. Send the value of the height value and rectangle ratio value from
the preferences to the constructor. When focus is on a rectangular child, show the word Custom in the status bar along with the current
background color of the child. Update the status bar when the color changes, too. Remember that the child may know nothing about the parent.
- Add an item for closing all open children. The item should not appear if no children are open.
- Add an item for closing the application.
- Add a top level menu named Help.
- Add a menu Oath to the Help menu.
- This is not a child form, it is a normal dialog.
- When clicked, display a new modal form.
- 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.
- This is not a child form, it is a normal dialog.
- When clicked, display a new modeless form.
- Only allow one About dialog to be open at one time.
- 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
- Create an icon in the resource editor that contains the initials of one of the members in the group. Set the icon for the form to the intials icon.
- Set the context menu to the context menu for the preferences.
- When the form closes, ask the user if they really want to close the
application. Only close the application if the user confirms.
Create a video
Create a 2-5 minute mp4 video. You may use the free version of
Screencast-o-matic. The video must include:
- A complete walk through of the running program.
- Comment on and show any sections of code that your group is proud of.
Submitting the Assignment
Zip your entire project and upload via the Assignment Dropbox on BlackBoard.
Exclude the Debug and Release directories.
Be sure to include your control library in your uploaded file.
Upload your video to me using the upload via the Assignment Dropbox on BlackBoard.