Image de fond dans API sous Visual C++
Salut.
j'ai développé une application sous visual C++ mais je n'arrive pas à afficher une image en fond d'écran.
Ma fonction est :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| void CMainFrame::ImageFond(CDC* pDC)
{
CBitmap bmp;
CBitmap *ptrBmpOld;
CDC dcMemory;
BITMAP bm;
CRect rect;
Invalidate(TRUE);
bmp.LoadBitmap(IDB_IMAGE_LARGE);
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);
} |
et cette fonction est appellée dans
Code:
1 2 3 4 5
| BOOL CMainFrame::OnEraseBkgnd(CDC* pDC)
{
ImageFond(pDC);
return TRUE;
} |
Mon image s'affiche :D mais couvre la barre des taches :( ainsi que les autres fenetres :x . Et lorsque je déplace la fenetre d'application mon image disparait 8O .
Je n'arrive pas à voir d'où cela vient.
Y aurait il d'autres paramètres à régler dans mon application pour avoir une jolie image en font d'écran ?
Merci pour votre aide :wink:
A+