COP4226, Extra Credit 4
Due Friday, November 15 (not late until 6 am 11/16)
Create a Windows Forms Application in Visual Studio. The project will handle arrow keys, implement drag and drop, and serialize data to and from a file.
Main Form
The main form will have a main menu and a multiline text box that fills the client area.
Main Menu
The main menu will have a File
menu with the following items.
- New
- Clear the text box. Clear the file name, if the file has been saved.
- Save
- Serialize the file. If the file has not been saved before, then ask the user for the name of the file. If it has already been saved, then use the previous file name again.
- Open
- Prompt for the name of a file that has been saved by this program.
- Print
- Print the text from the text box.
- Use the real page bounds and real margin bounds.
- Print your name, centered at the top of each page as a header, outside the margin bounds.
- Print the name of the course at the bottom left of each page, outside the margin bounds.
- Print the name of the assignment at the bottom right of each page, outside the margin bounds.
- Use a large font for the header and footer.
- Use a smaller font for the body of the page.
- Use the split function for strings to split the text into words. Print as many words per line as possible. Print as many lines per page as possible. If there are more words, then go to a new page.
- Do not print directly. Open a print dialog for the user to select a printer.
- Print Preview
- Open a print preview dialog and show how the text will look when printed.
- Exit
- Close the application, nicely
Drag and Drop
Enable dragging and dropping.
- Allow text to be dropped into the text box.
- Allow selected text from the text box to be dragged to a text editor. Do not start a drag if no text is selected.
Arrow Keys
In addition to the arrow keys moving the cursor in the text box, they should also move the location of the main form. Each arrow press should move the location of the form one pixel in the direction of the arrow.
The arrow keys can be caught in the main form, since the preview command will bubble to the parent, unless the child returns false. The text box does not return false when processing command keys.
Submitting Homework
Zip your entire project and upload it on the web. Exclude the
Debug and Release directories.
Submitting
Homework Online.