Bonjour
Je code sous visual C++ / dev C++
J'affiche une image bmp sur une fenêtre. Mais quand je rétrécis la fenêtre et que je l'agrandis après, l'image disparaît. La même chose se produit quand une autre application passe au dessus de mon image.
J'ai trouvè une solution
Ma question est la suivante : "Est-ce que ma façon de faire est la plus propre ou en existe t'il une autre"?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 if(WM_PAINT==uMsg) afficheFond(hwnd,724,0);
Ou alors j'ais mal codée ma fonction qui affiche l'image.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 void afficheFond(HWND hwnd,int hauteur,int longueur) { HDC hdc; POINT pt; HBITMAP hBitmap; HDC hMemDC; PAINTSTRUCT ps; BITMAP bm; hdc = BeginPaint(hwnd, &ps); hBitmap = (HBITMAP) LoadImage( NULL, "menuLogo.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); hMemDC = CreateCompatibleDC (hdc); SelectObject (hMemDC, hBitmap); GetObject (hBitmap, sizeof (BITMAP), &bm) ; pt.x = bm.bmWidth; pt.y = bm.bmHeight; BitBlt (hdc, 1114, hauteur-99-10, pt.x, pt.y, hMemDC, 0, 0, SRCCOPY) ; EndPaint (hwnd, &ps); }
Partager