- HBITMAP hBitmap1 = (HBITMAP) image.GetHBITMAP();
- HBITMAP hBitmap2 = 0;
- if ( image.GetMask() )
- hBitmap2 = (HBITMAP) image.GetMask()->GetMaskBitmap();
+ UINT flags = 0 ;
+ if (image.GetDepth() <= 4)
+ flags = ILC_COLOR4;
+ else if (image.GetDepth() <= 8)
+ flags = ILC_COLOR8;
+ else if (image.GetDepth() <= 16)
+ flags = ILC_COLOR16;
+ else if (image.GetDepth() <= 24)
+ flags = ILC_COLOR24;
+ else
+ flags = ILC_COLOR32;
+
+ bool mask = (image.GetMask() != 0);
+ if ( mask )
+ flags |= ILC_MASK;
+
+ m_hImageList = (WXHIMAGELIST) ImageList_Create(image.GetWidth(), image.GetHeight(), flags, 1, 1);
+
+ int index;
+ if (!mask)
+ {
+ HBITMAP hBitmap1 = (HBITMAP) image.GetHBITMAP();
+ index = ImageList_Add(GetHimageList(), hBitmap1, 0);
+ }
+ else
+ {
+ HBITMAP hBitmap1 = (HBITMAP) image.GetHBITMAP();
+ HBITMAP hBitmap2 = (HBITMAP) image.GetMask()->GetMaskBitmap();
+ HBITMAP hbmpMask = wxInvertMask(hBitmap2);