|
||
The example code here shows how a PrintBandL()
function,
inherited from MPageRegionPrinter
by a concrete band printer
class, may be structured. Before drawing, a graphics context in which to draw
to must be created.
Set up an appropriate graphics context using
CreateContext()
.
Print the requested band on the requested page using the graphics context drawing functions.
Clean up the graphics context.
void CMyBandPrinter::PrintBandL(CGraphicsDevice* aLayoutDevice,
TInt aPageNo,
const TBandAttributes& aBand)
{
// Set up the GC and push to cleanup stack
CGraphicsContext* gc;
aLayoutDevice->CreateContext(gc);
CleanupStack::PushL(gc);
// Call some function to do the drawing: here we pass the graphics context, device, page number, offset, and display rectangle
DoDraw(*(gc),aLayoutDevice,aPageNo,TPoint(0,0),
TRect(TPoint(0,0),KA4PaperSizeInTwips));
CleanupStack::PopAndDestroy(); // cleanup the GC
}