I create and initialize the TImageList
...
ImageList:=TImageList.Create(self);
ImageList.ShareImages:=true;
I get the system ImageList handle for small icons (16x16)...
ImageList.Handle:=SHGetFileInfo('',0,FileInfo,SizeOf(FileInfo),SHGFI_SYSICONINDEX or SHGFI_SMALLICON);
And now I want to draw the icons on my control canvas scaled to 50x50 pixels. How I do this ?
Upscaling small icons is never good idea. 16X16 icon is too small to use it in any other way other as-is.
For start you can get larger shell images using
Those images will be generally 32x32 pix, but to be on safe side (if Windows are running in high DPI mode) you can get correct size from system
You can also get even larger shell images with
SHGetImageList
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762185%28v=vs.85%29.aspxTo retrieve icon from you ImageList (if ImageList contains icons, and in your case it does) you can use:
For scaling icons, while preserving transparency, to custom dimension you can use following code: