cs_Batman60
Messages postés71Date d'inscriptionsamedi 21 mai 2005StatutMembreDernière intervention21 octobre 2007
-
25 mai 2006 à 11:58
BruNews
Messages postés21040Date d'inscriptionjeudi 23 janvier 2003StatutModérateurDernière intervention21 août 2019
-
25 mai 2006 à 12:21
salut à tous
est-il possible d'ouvrir et d'afficher un fichier jpeg à l'aide des fonctions de windows
pour l'instant j'utilise le code ci-dessous pour bitmap seulement à l'aide de la boite de dialogue GetOpenFileName(&ofn)
ofn.lpstrFilter = "Fichier Bitmap (*.bmp)\0*.bmp\0Fichier Jpeg (*.jpg)\0*.jpg\0\0";
ofn.lpstrFileTitle = szNomDocumentCourt;
en résumé je voudrais avoir le choix d'afficher un bitmap ou jpeg mais je ne sais pas quelle fonction utiliser, si elle existe ?
case WM_PAINT:
HDC hdc;HDC hdcMemory;
PAINTSTRUCT ps;
hdc=BeginPaint(hwnd,&ps); // obtient un handle de contexte de périphérique
// un bitmap
BITMAP bm; //0,0, par défaut
hbitmap=(HBITMAP) LoadImage(NULL,szNomDocumentCourt,
IMAGE_BITMAP,0,0,LR_LOADFROMFILE);
hdcMemory=CreateCompatibleDC(NULL);
SelectObject(hdcMemory,hbitmap);
GetObject(hbitmap,sizeof(bm),&bm);
/*BitBlt(hdc,0,0,bm.bmWidth,bm.bmHeight,hdcMemory,0,0,SRCCOPY);*/
// Zoom sur la partie supérieur droite
SetStretchBltMode(hdc, STRETCH_HALFTONE);//image nette
StretchBlt(hdc,0,0,bm.bmWidth*25/100,bm.bmHeight/4,hdcMemory,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);
DeleteDC(hdcMemory);
EndPaint(hwnd,&ps); // libère un handle de contexte de périphérique
break;