Bonjour
Dans un programme en visual c++ avec MFC, jai une image de fond se lancant au debut de l'application (grace a la fonction "OnEraseBkgnd(CDC* pDC) ").
Je voudrais que l'image de fond change apres avoir utiliser une boite de dialogue, mais la nouvelle image ne s'affiche pas. En fait si je réduis la fenetre et que je la ragrandis, la nouvelle image apparait.
J'aimerai savoir commment faire pour que mon image s'affiche automatiquement.
merci d'avance.
BOOL CProgView::OnEraseBkgnd(CDC* pDC) {
CBitmap bmp,bmp2;
CBitmap *ptrBmpOld,*ptrBmpOld2;
CDC dcMemory,dcMemory2;
BITMAP bm,bm2;
CRect rect,rect2;
if (joueur->nom=="")
{bmp.LoadBitmap(imagepresentation);
bmp.GetBitmap(&bm);
GetClientRect(rect);
dcMemory.CreateCompatibleDC(pDC);
ptrBmpOld=dcMemory.SelectObject(&bmp);
pDC->StretchBlt(0,0,rect.Width(),rect.Height(),&dcMemory,0,0,bm.bmWidth,bm.bmHeight, SRCCOPY );
dcMemory.SelectObject(ptrBmpOld);
}
else
{bmp2.LoadBitmap(imagesommaire);
bmp2.GetBitmap(&bm2);
GetClientRect(rect2);
dcMemory2.CreateCompatibleDC(pDC);
ptrBmpOld2=dcMemory2.SelectObject(&bmp2);
pDC->StretchBlt(0,0,rect2.Width(),rect2.Height(),&dcMemory2,0,0,bm2.bmWidth,bm2.bmHeight, SRCCOPY );
dcMemory2.SelectObject(ptrBmpOld2);
}
return TRUE;