Hi, I know this topic has been up several times, and I have searched different thread for several days without any sucess of solving my problem.

I have no problem with printing text, lines etc, but when it comes to a bitmap things get complicated for my small brain.

The bitmap shows in the preview but I only get empty papers from the printer. Anyone know what I do wrong?


this is how my OnPrint looks like.

void CPrinttest1View::OnPrint(CDC* pDC, CPrintInfo* /*pInfo*/)
{
pDC->SetMapMode(MM_TWIPS);

CBitmap bmp;
bmp.LoadBitmap(IDB_BITMAP1);

CRect rectDraw(40,40,250,250);

CDC memDc;

memDc.CreateCompatibleDC(pDC);

CBitmap *pOldBmp = memDc.SelectObject(&bmp);
BITMAP bm;
bmp.GetBitmap(&bm);

CSize pBmpSize;

//A 'normal' copy, but it still needs a stretch because of the map mode
long nWidth = this->PointsToTwips(bm.bmWidth);
long nHeight = -this->PointsToTwips(bm.bmHeight);
POINT pos = this->PointsToTwips(rectDraw.left, rectDraw.top);
pDC->StretchBlt(pos.x, pos.y, nWidth, nHeight, &memDc, 0, 0,
bm.bmWidth, bm.bmHeight, SRCCOPY);

pBmpSize.cx = bm.bmWidth;
pBmpSize.cy = bm.bmHeight;


memDc.SelectObject(pOldBmp);

}

All help will be appretiated

thx
Anders Jansson