COP4226, Homework 2
Due Thursday, October 15 at 5pm.
Zip your entire project and upload on the web. Exclude the
Debug and Release directories.
Submitting
Homework Online.
Control Library
You will add some classes to the control library from Homework 1. If you
did not create the control library, then you will need to create it now.
Add the project to the Homework 2 solution.
-
Modify the user control for your name so that it uses a linear gradient brush.
Make the background of the text transparent, so the brush can be seen.
-
Modify the user control for the course so that it uses a path gradient brush.
Make the background of the text transparent, so the brush can be seen.
-
Add a user control that can be moved using the mouse and using the keyboard
(see relevant example from Chapter 2).
-
Use the mouse events to allow the user to drag the control.
-
Use the key events to allow the user to move the control with the arrow keys.
-
This control will be used as a base control for controls that will be created
in the main project.
-
Add a form that will be used as a base form for dialogs.
-
Dock a panel to the top of the form.
-
Add a name control to the panel.
-
Add a course control to the panel.
-
Dock a horizontal splitter under the top panel (do not use a SplitContainer,
use a Splitter)
-
Change the width and color of the splitter so that it can be seen easily.
-
The splitter should be able to be moved by the user at run time.
-
Dock a panel that fills the lower area of the form.
-
Remove the minimize and maximize buttons.
-
Change the access modifier for all of these so that derived classes can access
them.
-
Add a form that will be used as a base form for the main form in the main
project.
-
Implement the IOptions interface. Encapsulate user settings.
-
Add a tooltip component; only add one for the entire form.
-
Add a menu strip. Add a top level menu item named Help.
-
Add a menu item named Oath
-
Add a menu item named About.
-
Add handlers for both of these menu options; make them virtual.
-
Add tool tips to the menu items.
-
Add a status strip.
-
Add a main panel that fills the remaining area of the form; if the form is
resized, the panel should still fill the rest of the client area.
-
Change the access modifier for all of these so that derived classes can access
them.
IOptions Interface
Create an interface, named IOptions, with the following properties.
-
pen color
-
shape color
-
pen width.
Main Project
-
Create a user control that extends the movable user control in the control
library.
-
Change its shape to a closed bezier curve.
-
Draw the edge of the shape with the current pen color and pen width.
-
Use the current shape color as the background color for the shape.
-
Create a user control that extends the movable user control in the control
library.
-
Change its shape to
an arc a closed arc (otherwise known as a pie).
-
Draw the edge of the shape with the current pen color and pen width.
-
Use the current shape color as the background color for the shape.
-
Create a dialog derived from the base dialog class in the control library.
-
Change the title of the dialog to Oath Dialog.
-
Add the user control for the oath to the bottom panel. Anchor it so that
it grows and shrinks as the dialog is resized.
-
Create a dialog derived from the base dialog class in the control library.
-
Change the title of the dialog to About Dialog.
-
Add a text box to the bottom panel.
-
Allow more than one line in the text box.
-
Do not let the user modify the contents at run time.
-
Do not have a border around the text box.
-
Set the text of the box to a good description of this assignment.
-
Anchor it so that it grows and shrinks as the dialog is resized.
-
Create a dialog derived from the base dialog class in the control library.
-
Implement the IOptions dialog.
-
Change the title of the dialog to Options Dialog.
-
Initialize the dialog's properties with the current values for the colors
and pen width.
-
The details of this dialog are explained in the section after the main project
section.
-
Draw the edge of the main panel with a compound pen.
-
Fill the background of the main panel with a hatched brush.
-
Extend the main form from the base, main form in the control library.
-
Implement the IOptions interface.
-
Encapsulate corresponding user settings.
-
When the message from the options dialog is broadcast, update the colors
and pen width with the properties from the dialog.
-
Override the click handler for the oath menu item so that it opens the oath
dialog modally.
-
Do not add a new event handler to the click event; override the handler that
already exists in the base class.
-
Override the click handler for the about menu item so that it opens the about
dialog modally.
-
Do not add a new event handler to the click event; override the handler that
already exists in the base class.
-
Insert a new menu item into the base menu. This cannot be done in the designer,
due to issues with visual inheritance of collection containers.
-
Add a context menu to the main form.
-
Add an item named Options; when the item is clicked, open an options dialog
modelessly.
-
Only allow one options dialog to be open at a time.
-
Open the dialog so that it abuts the right edge of the main form.
-
Be sure that the options dialog is always in front of the main form, even
when the main form has focus; be sure the option dialog is minimized when
the main form is minimized.
-
Add an item named Save Options; when the item is clicked, save the user settings.
-
Add a tool tip to each menu item.
-
At run time, create a new menu item with a label of Tools.
-
Set the DropDown event handler to the context menu.
-
Insert the menu item into the base menu.
-
Insert a new menu item into the base menu. This cannot be done in the designer,
due to issues with visual inheritance of collection containers.
-
Add a context menu to the main form.
-
Add an item named Bezier.
-
Add an item named Arc.
-
Add tool tips to the menu items.
-
When a menu item is clicked,
-
add a corresponding user control to the collection of controls in the main
panel from the base class.
-
position all new controls at the upper, left corner of the main panel.
-
change the cursor whenever the mouse is over a shape. Use a different cursor
for bezier and arc shapes.
-
At run time, create a new menu item with a label of Shapes.
-
Set the DropDown event handler to the context menu just created.
-
Insert the menu item into the base menu.
-
Update the status strip as follows.
-
If the mouse is over a bezier shape, show Bezier in the status strip.
-
If the mouse is over an arc shape, show Arc in the status strip.
-
If the mouse is not over either, then do not show a message in the status
strip.
Options Dialog
-
Add a help provider. Set help information for the buttons and up down control.
-
Add a help button so that it is visible in the title bar.
-
Open the dialog modelessly. Have three buttons: Close,
Apply, Cancel.
-
Apply: broadcast a message that the dialog has new data, do not close the
dialog.
-
Close: broadcast a message that the dialog has new data and close the dialog.
-
Cancel: do not broadcast a message and close the dialog.
-
The dialog may not reference the main form in any way.
-
Imlpement the IOptions interface. Encapsulate corresponding values from form
controls.
-
Add a button that will open a color dialog.
-
It will select the color of the pen to use when drawing shapes.
-
Initialize the color dialog with the current pen color.
-
Add a button that will open a color dialog.
-
It will select the background color of the shape controls.
-
Initialize the color dialog with the current background color for the shape
controls.
-
Add a numeric up down control that has a range of 1 to 10. This will control
the width of the pen.
-
Tile the dialog with an image that is smaller than the dialog. Flip in the
X and Y direction.
-
Add a button to recolor the image.
-
When clicked, look for the pen color in the image and change it to the shape
color.
Screen Shot