COP4226, Exercise 1
Due Friday, February 1 at 11:59 pm.
Zip your entire project and upload on the web. Exclude the
Debug and Release directories.
Submitting
Homework Online.
Create a forms based application.
Login Dialog
-
Add an image to the application resources that contains a word. You may create
this image or download one from the web. You have seen such images on many
sites. The user must type the word in the image into a text box. This dialog
is doing the same thing, except that the image will be the same every time
the application is run.
-
Create a dialog that contains a label, text box, image and an OK button.
-
Add a public property to the dialog for reading (not writing) the value of
the text box.
-
Set the button as the default button on the form: whenever the Enter Key
is pressed, the button will be clicked.
-
Display this dialog before the main form of the application is run.
-
The label should instruct the user to type the word that is in the image
into the text box and hit the OK button. If the user enters the correct word,
then run the application. If the user types the wrong word, then do not run
the application.
Control Library
-
Add a control library to the solution. Only add one control library: it will
contain three controls.
Form
-
Center your name, from the control library, at the top of the form. When
the form is resized, the name should remain centered.
-
Set the minimum size for the form so that controls never disappear.
-
Add an image resource to the application resources.
-
Add an image to the main form's resources.
-
Add a radio group to the form.
-
Set the background image of the form based upon the radio button selected.
-
Application: set the background image to the resource that you added to the
application resources.
-
Local: set the background image image of the form to the local resource that
you added to the form's resources. (Perhaps the form editor will tell you
how to do this.)
-
None: do not set a background image.
-
The background image of the main form should appear as the background of
the radio group.
-
Initialize one of the radio buttons in the checked state. Set the initial
background of the form according to the initial checked button.
-
Add a panel to the form.
-
Add a border to the panel.
-
The background of the panel should be the same as the background image and
color of the parent form.
-
Add a label to the panel.
-
Set the background color of the label.
-
Add a border to the label.
-
Place some relevant text in the label.
-
The label can be moved anywhere inside the panel.
-
The label is moved by dragging the mouse.
-
The mouse point should stay in the same relative position in the label, except
when the label encounters a panel edge. The mouse may be moved outside the
panel, but the label should always be completely visible (including the border)
in the panel. The label should follow the mouse when the mouse is outside
the panel, as best as it can.
-
The width of a border is not included in the width of a control. To obtain
the width of the border, use the SystemInformation.BorderSize property.
-
Add a menu to the form. Add a top level menu named Help.
-
Add a menu item named Oath to the Help menu. When clicked, display a new
modeless form.
-
Position the window 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.
-
When the main form is moved or resized, maintain the window to the right
of the 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.
-
The new form may not access any properties of the main form.
-
Center the user control for the name at the top of the form. The name should
remain centered when the form is resized.
-
Center the user control for the course and section below the name. The course
and section should remain centered when the form is resized.
-
Center the user control that contains the oath below the section. The user
control should remain centered when the form is resized.
-
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.
-
The new form may not access any properties of the main form.
-
Center the user control for the name at the top of the form.
-
Center the user control for the course and section below the name.
-
Add a label that describes this assignment.
-
Add two text boxes to the form and two buttons.
-
One text box will hold an x-coordinate. The other text box will contain a
y-coordinate.
-
One button will set the Location property based on the x- and y-coordinates.
Only change the Location if both coordinates are valid.
-
One button will set the DesktopLocation property based on the x- and
y-coordinates. Only change the DesktopLocation if both coordinates are valid.
-
Validate that each coordinate is between -500 and 500. Use an error proivder
to show icons when there are errors.
-
Set CausesValidation to true on all controls in the form. Allow an invalid
box to lose focus.
-
When either of the buttons is clicked, validate that the coordinates are
valid. If they are not valid, display a message box and do not change the
location. If the coordinates are valid, change the coordinates.
-
Add a notify icon to the form.
-
Add a context menu to the notify icon that has text boxes to the form and
two buttons. These will implement the same functions as the coordinate text
boxes and location buttons that are in the form. You do not need to validate
the coordinates, just be sure to enter valid values.
-
Create an icon for the notify icon that contains your initials. Use the icon
editor from the resources. Edit the 32x32 icon.
-
Be sure to dispose your notify icon when the application closes, so that
there is not an orphaned icon in the system tray.
-
Add a status bar. Display the current value of the location of the window.
Update the status bar with the current location when the form is loaded,
resized or moved.
-
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.