Question
I’m trying to print my grid, with some help of the samples in this knowledge base. I succeeded almost, but I need some explanation of the parameters that go with the PrintPage event:
Overloads Public Sub PrintPage( _
ByVal G As Graphics, _
ByVal Margins As Rectangle, _
ByVal aGridWidth As Integer, _
ByVal aDateScalerHeight As Integer, _
ByVal suppressGrid As Boolean, _
ByRef HasMorePages As Boolean, _
ByVal doNotStepGridWillPrintTheSameRowsOneMoreTime As Boolean _
)
What exactly do the HasMorePages and doNotStepGridWillPrintTheSameRowsOneMoreTime parameters mean, and how should I use them?
Answer
The HasMorePages is a value that will be set to true if the content did not fit on the space given. If it does fit, the HasMorePages will be set to false.
The Grid prints the visible nodes to the given space and remembers the first node that did not fit. This node will be the first on the next page that is produced when you call PrintPage again.
If you want to produce multiple pages in the x-direction (Like a chart that needs 5 pages across the time direction) you need to instruct the grid that it should not start next print on the first node that did not fit, but rather on the same node as last time… You do this by setting the doNotStepGridWillPrintTheSameRowsOneMoreTime = true.
There is a sample of the multi page print with two pages across the time axis in the general download. The sample is called GanttTest.
This is a comment from that sample:
// In this print I choose to divide the time axel into two pages.
// Then I must call PrintPage once with SuppressGrid=false and doNotStepGridWillPrintTheSameRowsOneMoreTime=true
// and once with SuppressGrid=true and doNotStepGridWillPrintTheSameRowsOneMoreTime=false
// In the second call I change the DateScaler intervall to reflect another area in time, then I set it back
// after the print to prepare for the first page in time (x) direction