Bitmap drucken
-
Hallo zusammen!
Ich möchte gerne ein Bitmap, welches in meinen Resourcen gespeichert ist, drucken (IDB_BITMAP1).
Warum funktioniert dieser Code nicht?
dcPrint.SetMapMode(MM_LOMETRIC); CBitmap bmp; bmp.LoadBitmap(IDB_BITMAP1); // get the bitmap's size BITMAP BM; bmp.GetObject(sizeof(BM),&BM); long lBmpHeight = BM.bmHeight; long lBmpWidth = BM.bmWidth; // 2. Create a memory device context, compatible to the screen CDC memDC; memDC.CreateCompatibleDC(&dcPrint); // 3. Select the bitmap into it with CDC::SelectObject() CBitmap* pOldBitmap = memDC.SelectObject(&bmp); // 4. Blit (or stretch-blit) the mem-DC into the printer-DC dcPrint.StretchBlt(375,350,lBmpWidth,lBmpHeight,&memDC,0,0,lBmpWidth,lBmpHeight,SRCCOPY); // 5. deselect the bitmap from the mem-DC memDC.SelectObject(pOldBitmap); // 6. destroy the bitmap and the mem-DC bmp.DeleteObject(); memDC.DeleteDC();Könnt ihr mir helfen, es ist sehr wichtig!!!
greetz
tompo
-
Bei MM_LOMETRIC liegt der Koordinatenursprung unten links.