load_image_256.txt
上传用户:aimelife
上传日期:2007-01-01
资源大小:1k
文件大小:1k
- This is how to use 256(or 16bit, 24bit)-color bitmaps in ImageLists for ListViews, TreeViews, etc...
- Usually you use something like this to load/create your imagelist:
- hScreens = ImageList_LoadImage(GetModuleHandle(NULL),
- MAKEINTRESOURCE(BMP_SCREENS), 100, CLR_NONE, CLR_NONE, IMAGE_BITMAP,
- LR_LOADTRANSPARENT);
- However it will always convert your bitmap to 16 colors or fail. now, simply replace it with this code:
- HBITMAP hScrBM;
- hScreens = ImageList_Create(100, 70, ILC_COLOR8, 0, 999);
- hScrBM = LoadImage(GetModuleHandle(NULL),
- MAKEINTRESOURCE(BMP_SCREENS256), IMAGE_BITMAP, 0, 0,
- LR_LOADTRANSPARENT);
- ImageList_Add(hScreens, hScrBM, NULL);
- DeleteObject(hScrBM);
- Of course, you can use other values instead of ILC_COLOR8 (256color): ILC_COLOR16, ILC_COLOR24, ... (see "ImageList_Create()" online help in VC++)