Riot Buy me a riot | Bonjour,
Je dispose d'une liste d'images que je souhaiterais resizer puis afficher dans un CListCtrl.
Pour l'instant j'ai ce code qui fonctionne mais qui ne redimensionne pas les images :
Code :
- // listeElements contient la liste des images à afficher
- std::list<Element*>::iterator it;
- m_ImageList.Create( WIDTH, HEIGHT, ILC_COLOR24, 0, 1 ); // WIDTH et HEIGHT sont la taille originale des images
- m_CtrlList.SetImageList( &m_ImageList, LVSIL_NORMAL );
- for( it = listeElements.begin(); it != listeElements.end(); ++it )
- {
- int a = lstrlenA((LPCTSTR)(*it)->chanIcon); // chanIcon est le chemin vers mon image
- BSTR szBuffer = SysAllocStringLen(NULL, a);
-
- CClientDC cdc(this);
- CDC memDC1;
- memDC1.CreateCompatibleDC( &cdc );
-
- ::MultiByteToWideChar( CP_ACP, 0, (LPCTSTR)(*it)->chanIcon, a, szBuffer, a );
-
- Gdiplus::Bitmap m_pBitmap(szBuffer,TRUE);
- HBITMAP bm = CreateCompatibleBitmap( cdc.m_hDC, m_pBitmap.GetWidth(), m_pBitmap.GetHeight() );
- m_pBitmap.GetHBITMAP( RGB(0,0,0), &bm );
-
- CBitmap Bitmap;
- Bitmap.Attach(bm);
- int ret = m_ImageListVodChannel.Add( &Bitmap, RGB(0, 0, 0) );
- m_CtrlListVOD.InsertItem( nIndex, NULL, nIndex );
- m_CtrlListVOD.RedrawItems( nIndex, nIndex );
-
- DeleteObject(bm);
- ::SysFreeString(szBuffer);
- }
|
J'ai essayé de modifier WIDTH et HEIGHT avec les nouvelles valeurs que je désire mais le résultat n'est pas celui attendu.
Auriez-vous une idée ?
Merci d'avance. ---------------
Be the one with the flames.
|