-
November 25th, 2007, 06:32 PM
#1
Why this code not print anything??
Code:
void CMAEC_SoftView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
// TODO: add customized printing code here
CBitmap bmpLogo;
bmpLogo.LoadBitmap(IDB_BITMAP_LOGO);
CDC dcLogo;
dcLogo.CreateCompatibleDC(pDC);
dcLogo.SelectObject(&bmpLogo);
pDC->BitBlt(0,0,bmpLogo.GetBitmapDimension().cx,bmpLogo.GetBitmapDimension().cy,&dcLogo,0,0,SRCCOPY);
dcLogo.DeleteDC();
}
-
November 26th, 2007, 06:19 AM
#2
Re: Why this code not print anything??
Hello,
Get the bitmap dimension using BITMAP object. For that add the following lines in place of your line containing BitBlt call.
Code:
BITMAP BM;
bmpLogo.GetBitmap(&BM);
pDC->BitBlt(0, 0, BM.bmWidth, BM.bmHeight, &dcLogo,0,0,SRCCOPY);
GetBitmapDimension will return the dimension of the bitmap in 0.1 mm units, which may not be the mapping mode of your printer DC.
Regards,
Pravin.
-
November 26th, 2007, 11:59 AM
#3
Re: Why this code not print anything??
Thanks Pravin, now I can see a black scuare in the print... some any idea why the result is a black scuare?
Very thanks for your reply.
-
November 26th, 2007, 12:04 PM
#4
Re: Why this code not print anything??
Because when you print you must use DIB Bitmaps. (Device Independent Bitmaps)
-
November 26th, 2007, 12:06 PM
#5
Re: Why this code not print anything??
Hi Luz.
And who can I change the resource bitmap to DIB bitmap??
-
November 26th, 2007, 12:10 PM
#6
Re: Why this code not print anything??
Have a look at this FAQ. Is not the best example of coding but should work.
http://www.codeguru.com/forum/showthread.php?t=234177
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|