Navigation bar
  Print document Start Previous page
 63 of 90 
Next page End  

Gravitybox Schedule.NET
1998-2005 Gravitybox Software LLC
Page 61 of 90
Chapter 7
Printing
Overview
After creating a schedule there are many times when you will wish to print a hard copy.
The GbSchedule.NET component has this functionality built-in. It will print the schedule
as you se it on the screen across multiple pages if necessary. There is even a print
preview to view the look of the print before it occurs.
Printing is very easy. There are only two methods: GoPrint and GoPreview. Each can
take a settings object to define the printable area. If either is called with no parameter
then the entire schedule is printed or previewed as defined by the properties MinDate,
MaxDate, StartTime, and DayLength. Also depending on the viewmode Providers or
Rooms might be shown as well.
To print an area of the schedule just setup the settings object and send it to the GoPrint
method as demonstrated in the following code snippet.
Dim settings As New PrintDialogSettings(#1/1/2004#, #8:00:00 AM#, _
        #1/5/2004#, #6:00:00 PM#)
Schedule1.GoPrint(settings)
You may define any area of the schedule as long as it is valid. This means that if the
MinDate is June 1, 2004, you cannot print from May 20, 2004 since it is not generated
by the schedule. The same is true for times as well. If the schedule displays 8am
through 6pm then you cannot print a schedule area from 3am in the morning.
There are numerous events that are raised during the course of a print. The order of
events is as follows: PrintSetup, BeforePrintHeader, BeforePrintFooter,
BeforePrintPageNumber, and PrintProgress. If the print is canceled then the
PrintCanceled is raised as well in no particular order.
PrintSetup
This event is raised before any printing starts and allows you to define a custom header
and footer height for all pages. It you do not wish to have a header or footer then you
can set the heights of these two sections to zero with the event parameter.
BeforePrintHeader
This event is raised before the header is drawn. You may cancel the default header by
setting the handled to true and drawing your own graphic in the defined rectangle. This
is called one time for each page.
BeforePrintFooter