Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21271

Some icons added to image list scale, others don't

$
0
0
I've been trying different methods to get a good thumbnail-capable file browser going. I had one method where I retrieved a normal 32x32 icon (this is for file types that don't support thumbnails--display their icon instead) and added it to the thumbnail imagelist. It automatically scaled to the thumbnail size. But it looked terrible.

So I found a way to get the 256,256 icons. But if no such icon exists, not only is it returning the 16,16... it's not scaling when I add it????? (it's the same image list, and there's no code to scale it, it should happen automatically)


Code:

iIcoIdx = GetFileIconIndexPIDL(pidlfqChild, SHGFI_LARGEICON)
hIcon = ImageList_GetIcon(hSysIL, iIcoIdx, ILD_NORMAL)
lRtn = ImageList_AddIcon(hIML_Thumb, hIcon)

This scales the icon to the size of the image list. hSysIL here is the normal 32,32 system image list.
However,

Code:

iIcoIdx = GetFileIconIndexPIDL(pidlfqChild, SHGFI_LARGEICON)
hIcon = ImageList_GetIcon(hSysIL256, iIcoIdx, ILD_NORMAL)
lRtn = ImageList_AddIcon(hIML_Thumb, hIcon)

This returns the 16,16 icon and does not scale it, so my list displays a tiny icon. (only for items for which there is no 256 icon available. For items that have one, it works perfectly-- hSysIL256 is the 256,256 system image list).

The documentation says every icon in an image list has to be the same size, so this shouldn't even be possible. But when I click on it, it only highlights the actual icon, so it's not a tiny image on a background image, it's a legit tiny icon.

Eventually I'd like to get the 32,32 and draw a border around it like explorer. But for now I'd settle for scaling it up like normal. Or maybe a simple way to determine if a 256,256 icon exists? Or measure the size of an hIcon?


Edit: Here's a pic showing the difference. The ONLY difference in code is shown above- pointing to the 32x32 instead of the 256x256.

Viewing all articles
Browse latest Browse all 21271

Trending Articles