1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
// variable globale de la vue (dans CMaVue.h)
CBitmap bitmap2; // c'est le bitmap de sauvegarde
CRect rcClient;
CMaVue::OnDraw(CDC* dc) {
CDC memDC;
// creation d'un DC en memoire .
memDC.CreateCompatibleDC( dc );
GetClientRect(&rcClient);
CBitmap bitmap;
bitmap.CreateCompatibleBitmap( dc, rcClient.Width(), rcClient.Height() );
memDC.SelectObject(&bitmap);
if (!fondFige) { AffichageFondVue(&memDC);
//Afficher le memDC
dc->BitBlt( rcClient.left, rcClient.top, rcClient.Width(),
rcClient.Height(), &memDC, 0,0, SRCCOPY );
// Sauvegarde du bitmap de fond
memcpy(&bitmap2,bitmap,sizeof(CDC) );
} //if
else {
// Restauration du bitmap de fond
memDC.SelectObject(&bitmap2);
dc->BitBlt( rcClient.left, rcClient.top, rcClient.Width(),
rcClient.Height(), &memDC, 0,0, SRCCOPY );
AffichageSpriteMobile(dc);
} //else
} //OnDraw |
Partager