COP4226 Assignment 3
Due Tuesday, 3/6 at 11:59 pm.
File |
Edit |
View |
Window |
Clear |
Cut |
Toolbar |
list of all open forms |
New |
Copy |
Status Bar |
|
Open |
Paste |
|
|
Save |
Font |
|
|
Close |
Color |
|
|
Print |
|
|
|
Print Preview |
|
|
|
Exit |
|
|
|
Create a Multi-SDI Application
-
Implement the Multi-SDI application from the book. You may start with the
application that is on the book's web site.
-
Instead of a text box, use a Rich Edit text box.
-
These text boxes allow for multiple fonts and colors.
-
They also have built in methods for cut, copy and paste.
-
The Modified property that can be used to remember if the text has
changed. There is no default implementation, all the details must be programmed.
-
The application will have a main menu with options like the table above.
-
Add a toolbar and a status bar to the application.
-
Add the standard toolbar buttons for new, open save, cut, copy and paste.
-
Enable the cut and copy icons when there is a selection in the text box.
-
Enable the paste icon when there is Text or RTF data in the clipboard. Use
the DataFormats.GetFormat method.
-
The state of these buttons should be updated when the application is idle.
-
In the status bar, display the current character count for the rich text
box and the length of the current selection.
-
File Menu
-
Clear - Delete the contents of the text box.
-
Before the text is erased, warn the user if data is to be lost. Give the
user three options.
-
Save the data.
-
Do not save the data.
-
Return to the application, without erasing the contents.
-
Be sure that the RTF text is deleted.
-
New - Open a new, top level window.
-
Open - Open a file in the current window.
-
Before the new file is opened, warn the user if data is to be lost. Give
the user three options.
-
Save the data.
-
Do not save the data.
-
Return to the application, without erasing the contents.
-
In the open file dialog, the file type list should include Text File (*.txt),
Rich Text Files (*.rtf) and All Files (*.*).
-
If the file is opened as Rich Text, then be sure that formatting of the file
appears as it should with fonts and colors.
-
If the file is opened as Text, then be sure that the data appears as plain
text. There should be no additional formatting of colors and fonts. If the
file contains Rich Text formatting codes, then they should appear as text.
-
Save - Save the data in a file.
-
If the data has already been saved, then save it using the current file name.
-
If the data was opened from a file, then save it using the current file name.
-
If the data has not been saved before or did not come from a file, then open
a save file dialog.
-
In the save file dialog, the file type list should include Text File (*.txt),
Rich Text Files (*.rtf) and All Files (*.*).
-
If the file is saved as Rich Text, then be sure that formatting of the file
is saved.
-
If the file is saved as Text, then do not save the Rich Text formatting codes.
Only save the plain text.
-
The file name of the current file should appear in the file name box of the
dialog.
-
The StringWriter class can be used to write to a file.
-
Close - Close the current, top level window.
-
Before the window is closed, warn the user if data is to be lost. Give the
user three options.
-
Save the data.
-
Do not save the data.
-
Return to the application, without erasing the contents.
-
If this is the last open window, then the application should close.
-
Print - Print the data from the text box.
-
Only print the plain text, do not print the rich text. A later assignment
will address printing the rich text.
-
Print a header that is centered at the top of each page. Include your name.The
header should display above the margin bounds.
-
Print the text within the margin bounds. Wrap text at the nearest word.
-
Print a footer that is centered at the bottom of the page. Inlcude the current
date. The footer should display below the margin bounds.
-
The StringReader class can be used to read a line at a time from a string.
-
PrintPreview - Open a print preview dialog for the text.
-
Exit - Close all the open forms.
-
Warn the user if data will be lost in each form before it is closed. Give
the user three options.
-
Save the data.
-
Do not save the data.
-
Return to the application, without erasing the contents.
-
Iterating through the open forms and closing them can cause exceptions. I
suggest that you use the array notation to access the open forms and close
them in reverse order.
-
Edit Menu
-
Cut - Cut the selected text. Only enable this option if there is selected
text.
-
Copy - Copy text from the clipboard. Only enable this option if there is
selected text.
-
Paste - Paste text from the clipboard. Only enable this option if there is
Text or RTF data in the clipboard. Use the DataFormats.GetFormat method.
-
Font - Open a font dialog.
-
Initialize the font dialog with the current font for the selection.
-
If the user selects OK, then set the font as the font for the current selection.
-
If the current selection has a length of zero, then the font will modify
new text added at the current location.
-
Color - Open a color dialog.
-
Initialize the color dialog with the current color for the selection.
-
If the user selects OK, then set the color as the color for the current
selection.
-
If the current selection has a length of zero, then the color will
modify new text added at the current location.
-
View Menu
-
Toolbar - When the item is clicked, toggle the visibility of the toolbar.
If the toolbar is visible, place a check mark next to the item.
-
Status Bar - When the item is clicked, toggle the visibility of the status
bar. If the status bar is visible, place a check mark next to the item.
-
Window Menu - This will contain a list of the open, top level forms. The
item for the current form should have a check next to it.
-
The rich text box has a property named Modified. Use this property
to remember if the text has changed since the text was cleared, opened or
saved.