Printing Labels - University of South Florida
Download
Report
Transcript Printing Labels - University of South Florida
Project 5: Printing Address Labels
1
Assignment
Write a Windows forms program to display
and print a set of address labels.
Input from a csv file.
Use Windows graphics to draw the labels.
Show the labels
In order of Zip Code, Last Name, First Name
Top to bottom, then left to right
4 labels across by 12 top to bottom
(OK if a few addresses overlap edge of label)
2
Main Menu
Provide a File menu with an Open
command.
Use Open File Dialog control to permit user to
select CSV file to open.
Provide Print and Print Preview commands
Print pages as shown on the form.
Provide a PrintDialog for the print command
Permit user to select From and To pages.
Commands enabled only when there is something to
print.
3
Main Menu
Provide a “View” menu with commands:
Previous Page
Next Page
Also an Exit command.
All commands should be enabled only if
applicable.
4
Sample Data File
A sample data file is available in the
Downloads area of the class web site:
http://www.cse.usf.edu/~turnerr/Software_Systems_Development/
Downloads/addresses.csv
5
Example: The Form
6
Print Preview
7
Implementation Hints
Think carefully about an object-oriented
design.
What are the classes?
What are their responsibilities?
Attributes and operations?
The same methods should paint the form and
print the page.
Graphics parameter determines which it does.
Different calls pass different Graphics objects to
paint the form and print the page.
8
Implementation Hints
After class design is sketched out
Start with minimal implementation and
add functionality in small steps.
Try to reuse code from in-class example.
Be sure each step is working correctly,
and you understand it, before adding
next step.
Revise class definitions as needed.
9
Implementation Hints
Implement Open command.
Read Addresses file.
Build List<Address_Record>
Sort List by zip code, last name, first name.
Display first page of labels on Form1.
Add Print command for first page only.
Implement Next Page and Previous Page commands.
Add ability to print all pages.
Add PrintDialog
Show any page on form.
Permit user to specify which pages to print.
Permit user to cancel Print command
Add Print Preview
10
Ground Rules
You may work with one other person.
If you do work as a pair
Both members are expected to contribute.
Submit a single program.
Both members should understand the program in
detail.
Do not share your code with other students.
OK to work alone if you prefer.
Before or after submitting the project.
OK to discuss the project.
Do not copy any other student’s work.
Don’t look at anyone else’s program.
Don’t let anyone look at your program.
11
Ground Rules
Except for code posted on the class web site
Do not copy code from the Internet
or any other source.
Write your own code.
12
Due Date
Project is due by 11:59 PM Wednesday night, March 30.
Deliverables:
Project Folder (zipped)
Zip the project folder and submit a single file.
Use the Windows “Send to Compressed File” command.
DO NOT use RAR.
If you work with another student, include both names in
the assignment comments.
Other student submit Blackboard comment only with both names.
End of Presentation
13