1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| CMyView::OnDraw(CDC *pDC)
{
CBitmap Bitmap;
CDC MemDC;
Bitmap.LoadBitmap(IDB_BMPESSAI); // lecture bitmap dans les ressources
BITMAP InfosBmp; // structure d'informations.
Bitmap.GetBitmap(&InfosBmp);
MemDC.CreateCompatibleDC(pDC);// creation d'un DC en memoire
MemDC.SelectObject(&Bitmap); // selection du bitmap dans le DC en memoire
// transfert final du bitmap dans le dc de la view.
// zoom x 2
CSize Size(InfosBmp.bmWidth *2 , InfosBmp.bmHeight *2);
pDC->DPtoLP(&Size);// si le systeme de coordonnées n'est pas MM_TEXT
pDC->StretchBlt( 0, 0,
Size.cx,-Size.cy,
&MemDC,
0, 0,
InfosBmp.bmWidth, InfosBmp.bmHeight,
SRCCOPY);
} |
Partager