Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


How to print bands

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.

  1. Set up an appropriate graphics context using CreateContext().

  2. Print the requested band on the requested page using the graphics context drawing functions.

  3. 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
    }

[Top]


See also

Drawing.