Insertion image dans une fenetre type Cview

Résolu
smallheart Messages postés 7 Date d'inscription mercredi 30 novembre 2005 Statut Membre Dernière intervention 11 décembre 2005 - 2 déc. 2005 à 20:42
smallheart Messages postés 7 Date d'inscription mercredi 30 novembre 2005 Statut Membre Dernière intervention 11 décembre 2005 - 3 déc. 2005 à 20:13
bonjour je suis debutant en visual c++ ,et j'aimerai savoir comment je peut inserer une image de type bmp ou jpeg (ou n'importe ) dans ma fenetre principale de type CView en MFC,j'aimerai savoir s'il y a un code à taper ou des fonctions qui gerent ca

keep walking

6 réponses

BunoCS Messages postés 15472 Date d'inscription lundi 11 juillet 2005 Statut Modérateur Dernière intervention 25 mars 2024 103
3 déc. 2005 à 12:35
En gros (sachant qur _Image a déjà été initialisée avant):

BITMAPINFO _BitmapInfo;
ZeroMemory(&_BitmapInfo, sizeof(BITMAPINFO));
_BitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFO);
_BitmapInfo.bmiHeader.biWidth = _Image->width;
_BitmapInfo.bmiHeader.biHeight = _Image->height;
_BitmapInfo.bmiHeader.biCompression = BI_RGB;
_BitmapInfo.bmiHeader.biBitCount = 24;
_BitmapInfo.bmiHeader.biPlanes = 1;
_BitmapInfo.bmiHeader.biSizeImage = _BitmapInfo.bmiHeader.biWidth *
_BitmapInfo.bmiHeader.biHeight *
_BitmapInfo.bmiHeader.biBitCount / 8;


SetDIBitsToDevice(dc.GetSafeHdc(), 0, 0, _BitmapInfo.bmiHeader.biWidth,
_BitmapInfo.bmiHeader.biHeight, 0, 0, 0,
_BitmapInfo.bmiHeader.biHeight, _Image->imageData,
&_BitmapInfo, DIB_RGB_COLORS);

Buno
----------------------------------------
L'urgent est fait, l'impossible est en cours. Pour les miracles, prévoir un délai...
3
vecchio56 Messages postés 6535 Date d'inscription lundi 16 décembre 2002 Statut Membre Dernière intervention 22 août 2010 14
3 déc. 2005 à 13:46
Il y a quand même plus simple a mon avis, en utilisant BitBlt (on crée un hdc mémoire pour la bitmap (CreateCompatibleDC, CreateCompatibleBitmap), puis on le copie dans le hdc de destination)
0
smallheart Messages postés 7 Date d'inscription mercredi 30 novembre 2005 Statut Membre Dernière intervention 11 décembre 2005
3 déc. 2005 à 20:05
keep walking
0
smallheart Messages postés 7 Date d'inscription mercredi 30 novembre 2005 Statut Membre Dernière intervention 11 décembre 2005
3 déc. 2005 à 20:08
slt v

keep walking
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
smallheart Messages postés 7 Date d'inscription mercredi 30 novembre 2005 Statut Membre Dernière intervention 11 décembre 2005
3 déc. 2005 à 20:11
merci pour ta reponse ,mais sachant ke je suis null en mfc je veu juste connaitre c'est koi le code à taper et ou je doit le taper,,,,,!!!merci bcp pour ta comprehension
keep walking
0
smallheart Messages postés 7 Date d'inscription mercredi 30 novembre 2005 Statut Membre Dernière intervention 11 décembre 2005
3 déc. 2005 à 20:13
merci bcp pour ta reponse mais je suis nul en mfc alors ton code j'ai rien compri dedans est ce ke tu peu stp m'expliqué un peu plus ,,pour height et wei

keep walking
0
Rejoignez-nous