Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

printing the contents of a tpaintbox

  • 23-04-2003 04:38PM
    #1
    Registered Users, Registered Users 2 Posts: 2,592 ✭✭✭


    hi does any body out there know of a way to proint the contents of a tpaintbox so far this is what i have

    TPrinter *Prntr = Printer();
    Prntr->BeginDoc();
    mainFrame->Canvas;
    Prntr->EndDoc();

    but the printer keeps throwing out blank pages???


Comments

  • Registered Users, Registered Users 2 Posts: 2,157 ✭✭✭dazberry


    You need to copy the contents of the paintbox canvas to the printer canvas.
    There are however a few problems.

    [1] TPaintbox does not store an image - hence the onpaint method. As a result you can't copy from a TPaintBox to another canvas.
    [2] Assuming you overcome [1], you will have scaling problems, because the printer canvas is a lot larger than the on screen canvas, so although things will appear fine onscreen, they'll be tiny on a printed page.

    TPrinter *Prntr = Printer();
    Prntr->BeginDoc();
    //mainFrame->Canvas;
    Prntr->Canvas->CopyRect(...)
    Prntr->EndDoc();

    Hint: Take a look at StretchBlt :D

    D.


Advertisement