k9
asked on
Printing BMP with MFC
When I'm printing a bitmap that I load from a file on disk, all that gets printed is a black box. Lines and text are printed correctly.
Here is a sample of the code I use....
CPrintDialog dlgPrint(FALSE,PD_ALLPAGES |PD_RETURN DC,NULL);
dlgPrint.DoModal().
CDC *pDC = new CDC;
pDC->Attach(dlgPrint.m_pd. hDC);
pDC->StartDoc("My Document");
pDC->StartPage();
CFont *pFont;
CDC dcImage;
if (dcImage.CreateCompatibleD C(pDC))
{
CBitmap m_Bmp;
m_Bmp.LoadBitmap("my_bmp.b mp");
dcImage.SelectObject(&m_Bm p);
pDC->BitBlt(x,y,width,heig ht,&dcImag e,0,0,SRCC OPY);
m_Bmp.DeleteObject();
dcImage.DeleteDC();
}
font.CreateFont(50,0,0,0,F W_BLACK,FA LSE,FALSE, 0,ANSI_CHA RSET,OUT_D EFAULT_PRE CIS,CLIP_D EFAULT_PRE CIS,DEFAUL T_QUALITY, NULL,"Aria l");
pFont = pDC->SelectObject(&font);
pDC->TextOut(x,y,"text");
Would appreciate any help with this.
Here is a sample of the code I use....
CPrintDialog dlgPrint(FALSE,PD_ALLPAGES
dlgPrint.DoModal().
CDC *pDC = new CDC;
pDC->Attach(dlgPrint.m_pd.
pDC->StartDoc("My Document");
pDC->StartPage();
CFont *pFont;
CDC dcImage;
if (dcImage.CreateCompatibleD
{
CBitmap m_Bmp;
m_Bmp.LoadBitmap("my_bmp.b
dcImage.SelectObject(&m_Bm
pDC->BitBlt(x,y,width,heig
m_Bmp.DeleteObject();
dcImage.DeleteDC();
}
font.CreateFont(50,0,0,0,F
pFont = pDC->SelectObject(&font);
pDC->TextOut(x,y,"text");
Would appreciate any help with this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Seems to be working OK now.