BitBlt not working on printer device context - Programmer

This is a discussion on BitBlt not working on printer device context - Programmer ; Hello, I am writing an MFC application to display coded text and hopefully print it out. The display part is fine, as is the print preview. However, when I make a printout there is nothing on the page, (I have ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: BitBlt not working on printer device context

  1. BitBlt not working on printer device context

    Hello,

    I am writing an MFC application to display coded text and hopefully
    print it out.

    The display part is fine, as is the print preview.

    However, when I make a printout there is nothing on the page, (I have
    tried two entirely different printers).

    I can make rectangles etc. print out ok, it is only bitmaps that do not
    appear on the printout.

    The bitmaps I am tryinng to print come from 24-bit resources (although
    the images themselves are black and white).

    The code I use to draw the bitmaps is:-

    SelectObject(hdcMem, theApp.hbitmap[c]);
    BitBlt(*pDC, x*block, y*block, block, block, hdcMem, 0, 0, SRCCOPY);

    I was wondering if anyone had experienced similar problems with bitmaps
    that display, but do not print out, or has any ideas what could be
    wrong?

    Regards,

    Lee Hanken


  2. Re: BitBlt not working on printer device context

    > The code I use to draw the bitmaps is:-
    >
    > SelectObject(hdcMem, theApp.hbitmap[c]);
    > BitBlt(*pDC, x*block, y*block, block, block, hdcMem, 0, 0, SRCCOPY);
    >


    You can ask the printer DC if it supports BitBlt:

    int nRasterCaps = pDC->GetDeviceCaps(RASTERCAPS);
    if (nRasterCaps & RC_STRETCHBLT)

    else (if (nRasterCaps & RC_RC_STRETCHDIB)


    HTH


+ Reply to Thread