ShellBrowser Delphi Components Documentation
ContentsIndexHome
PreviousUpNext
ShellBrowser.TJamSystemImageList.GetIndexFromExtension

Returns the icon number for a given extension.

Syntax
Pascal
class function GetIndexFromExtension(const Extension: string; aSize: TJamImageListSize = si_Small; Opened: Boolean = False): Integer;
Parameters 
Description 
const Extension: string 
The file extension of interest.  
aSize: TJamImageListSize = si_Small 
The image list size of interest. Default si_Small.  
Opened: Boolean = False 
Pass true if you need an opened icon if available. Default false.  

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');