Jump to content

System image lists for extra large and jumbo icons


LarsJ
 Share

Recommended Posts

System image lists

_WinAPI_ShellGetImageList (based on Shell_GetImageLists) in WinAPIShPath.au3 creates system image lists for small (16x16) and large (32x32) icons.

SHGetImageList creates system image lists for small, syssmall (usually 16x16), large, extra large (48x48) and jumbo (256x256) icons. Jumbo icons are supported on Vista+.

(On a Windows system, no more than these four system image lists exists (disregarding the syssmall list). That's why every decent icon editor by default should be able to create icons of the corresponding sizes.)

On XP you can scale up extra large icons to 64x64, 96x96, 128x128, 160x160, 192x192, 224x224 and 256x256 pixel icons to create image lists (not system image lists) with these sizes. On Vista+ you can scale down jumbo icons to create image lists with the same sizes.

GetSystemImageList in SystemImageLists.au3 is an implementation of SHGetImageList.

SHGetFileInfo can be used to insert icons for files and folders into the system image lists. To get the proper icons, it's important to call SHGetFileInfo with the full paths for the files and folders represented as PIDLs.

_WinAPI_ShellGetFileInfo in WinAPIShellEx.au3 is an implementation of SHGetFileInfo. But this function does not support PIDLs. GetSystemImageListIcon is based on code for SHGetFileInfo that supports PIDLs.

GetSystemImageListIcon inserts an icon into the system image lists, and returns the index of the icon. If the icon already exists, it just returns the index. If more system image lists are created (with different sizes), a single call of GetSystemImageListIcon (SHGetFileInfo) will insert the icon into all lists.

If you have created copies of the system image lists with other sizes, you have to manually create icons with the proper sizes, and insert into these image lists.

State information

SHGetFileInfo and GetSystemImageListIcon can extract state information for files and folders. GetSystemImageListIcon can extract ghosted, open folder and compressed states, and information for an overlay icon. File and folder states are demonstrated in the second example below.

If state information includes ghosted or compressed flags, GetSystemImageListIcon returns an array with icon index in first row and state flags (ghosted or compressed) in second row.

Note that state information not directly have anything to do with system image lists. But icon images in the lists are used to visually show file and folder states e.g. in a listview.

SystemImageLists UDF

SystemImageLists.au3 is a small (120 lines) UDF, which contains the two functions GetSystemImageList and GetSystemImageListIcon. The UDF creates five global constant variables $SHIL_LARGE, $SHIL_SMALL, $SHIL_EXTRALARGE, $SHIL_SYSSMALL and $SHIL_JUMBO with values 0 - 4.

Examples

First example

Two examples are included in the zip. The first example is pretty much the same as the example for _WinAPI_ShellGetImageList in the help file. This example fills a system image list with (hundreds of) icons, and draw the icons into a single big picture control. In the example here, a picture control is created for each icon, and the GUI window is supplied with a vertical scroll bar. The number of icons is limited to 100. There are five versions of the example. One version for each of the five system image lists. The version with jumbo icons can be run on Vista+.

Second example

The second example shows how to use system image lists in a listview. The starting point are empty system image lists, which gradually are filled with icons of files and folders, as you drop on the listview. Icons which represents a file or folder, are supplied with the name of the file or folder. Icons which represents an image in a list, are supplied with a name that shows the index. The example shows how to display different states of the files and folders, and it shows how to copy and resize the image lists.

This is a picture of the second example with a few extra large icons.

SystemImageLists_zps7bac8dd3.png

You see a ghosted folder, a folder with an overlay icon, four compressed and one uncompressed item.

The toolbar is hot-track enabled. To prevent flicker in the listview, resizing is done with this code by KaFu and Siao.

The menu items of the Icons button fills the listview with icons of the Desktop, Computer, Control Panel, Documents and the System image list. For the first four menu items, icons are added to existing icons. For the last menu item (System image list) existing icons are deleted, before images are filled into the listview.

The state items of the States button can be applied to icons which represents files or folders (icons with a name). Not icons which represents images in the system image lists (icons with a number). In absence of any of the former icons, the state items have no effect. The latter icons are deleted, when a state is set or unset.

The menu items of the View button sets the size of the icons. Note that overlay icons are not drawn for sizes, which does not represent a system image list.

The Delete button deletes the icons in the listview.

The example shows how to copy and resize icons to 64x64, 96x96, 128x128, 160x160, 192x192, 224x224 and 256x256 pixels, and create image lists with these sizes. When icons are scaled to other sizes, it's very important to use proper functions to do the scaling. If not you can easily get icons of poor quality. On XP the extra large (48x48) icons are scaled up to larger sizes. On Vista+ the jumbo (256x256) icons are scaled down to smaller sizes. Here the scaling is done with internal functionality of the image lists.

Zip file

The size of the zip is caused by 4 icon files which includes 256x256 pixel images.

System Image Lists.7z

Testet on XP 32 bit and Win 7 32/64 bit.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...