ShellBrowser Delphi Edition Documentation
ContentsIndexHome
PreviousUpNext
TJamSystemImageList.GetIndexFromExtension Method

Returns the icon number for a given extension.

Syntax
Pascal
class function GetIndexFromExtension(const Extension: UnicodeString; aSize: TJamImageListSize = si_Small; Opened: Boolean = False): Integer;

The number of the icon, which should be displayed for files with the given extension.

This method returns the number of the icon, which should be displayed for files with the given extension. You can use this index for example with the ImageIndex property of Delphi's TTreeNode and TListItem objects.  

It doesn't matter if the given extension has a leading dot or not.

The following examples will return the icon number for text files and bitmaps:

index := SystemImageList.GetIndexFromExtension('txt'); ListItem.ImageIndex := SystemImageList.GetIndexFromExtension('.bmp');
Copyright (c) 2011. All rights reserved.