const
CLR_NONE = $FFFFFFFF;
CLR_DEFAULT = $FF000000;
const
ILC_MASK = $0001;
ILC_COLOR = $00FE;
ILC_COLORDDB = $00FE;
ILC_COLOR4 = $0004;
ILC_COLOR8 = $0008;
ILC_COLOR16 = $0010;
ILC_COLOR24 = $0018;
ILC_COLOR32 = $0020;
ILC_PALETTE = $0800;
const
ILD_NORMAL = $0000;
ILD_TRANSPARENT = $0001;
ILD_MASK = $0010;
ILD_IMAGE = $0020;
ILD_BLEND25 = $0002;
ILD_BLEND50 = $0004;
ILD_OVERLAYMASK = $0F00;
const
ILD_SELECTED = ILD_BLEND50;
ILD_FOCUS = ILD_BLEND25;
ILD_BLEND = ILD_BLEND50;
CLR_HILIGHT = CLR_DEFAULT;
TImageList( unit KOL.pas ) TObj _TObj
TImageList = object( TObj )
Object type to incapsulate icon or cursor image.
type TImageListColors = (ilcColor, ilcColor4, ilcColor8, ilcColor16, ilcColor24, ilcColor32, ilcColorDDB, ilcDefault);
ImageList color schemes available.
type TDrawingStyles = ( dsBlend25, dsBlend50, dsMask, dsTransparent );
ImageList drawing styles available.
type TDrawingStyle = Set of TDrawingStyles;
Style of drawing is a combination of all available drawing styles.
type TImgLOVrlayIdx = 1..15;
type TImageType =( itBitmap, itIcon, itCursor );
ImageList types available.
type PImageList = ^ TImageList;
type PImageInfo = ^TImageInfo;
type TImageInfo = packed record
hbmImage: HBitmap;
hbmMask: HBitmap;
Unused1: Integer;
Unused2: Integer;
rcImage: TRect;
end;
function NewImageList( AOwner: PControl ): PImageList;
Constructor of TImageList object. Unlike other non-visual objects, image list can be parented by TControl object (but this does not *must*), and in that case it is destroyed automatically when its parent control is destroyed. Every control can have several TImageList objects, linked to a simple list. But if any TImageList object is destroyed, all following ones are destroyed too (at least, now I implemented it so).
TImageList Properties
property Handle : THandle;
Handle of ImageList object.
property ShareImages : Boolean;
True if images are shared between processes (it is set to True, if its Handle is assigned to given value, which is a handle of already existing ImageList object).
property Colors : TImageListColors;
Colors used to represent images.
property Masked : Boolean;
True, if mask is used. It is set to True, if first added image is icon, e.g.
property ImgWidth : Integer;
Width of every image in list. If change, ImageList is cleared.
property ImgHeight : Integer;
Height of every image in list. If change, ImageList is cleared.
property Count : Integer;
Number of images in list.
property AllocBy : Integer;
Allocation factor. Default is 1. Set it to size of ImageList if this value is known - to optimize speed of allocation.
property BkColor : TColor;
Background color.
property BlendColor : TColor;
Blend color.
property Bitmap : HBitmap;
Bitmap, containing all ImageList images (tiled horizontally).
property Mask : HBitmap;
Monochrome bitmap, containing masks for all images in list (if not Masked, always returns nil).
property DrawingStyle : TDrawingStyle;
Drawing style.
property Overlay[ Idx: TImgLOVrlayIdx ]: Integer;
Overlay images for image list (images, used as overlay images to draw over other images from the image list). These overalay images can be used in listview and treeview as overlaying images (up to four masks at the same time).
Set this value to 1..15 to draw images overlayed (using Draw or DrawEx).
TImageList Methods
function ImgRect( Idx : Integer ) : TRect;
Rectangle occupied of given image in ImageList.
function Add( Bmp, Msk : HBitmap ) : Integer;
Adds bitmap and given mask to ImageList.
function AddMasked( Bmp : HBitmap; Color : TColor ) : Integer;
Adds bitmap to ImageList, using given color to create mask.
function AddIcon( Ico : HIcon ) : Integer;
Adds icon to ImageList (always masked).
procedure Delete( Idx : Integer );
Deletes given image from ImageList.
Makes ImageList empty.
function Replace( Idx : Integer; Bmp, Msk : HBitmap ) : Boolean;
Replaces given (by index) image with bitmap and its mask with mask bitmap.
function ReplaceIcon( Idx : Integer; Ico : HIcon ) : Boolean;
Replaces given (by index) image with an icon.
function Merge( Idx : Integer; ImgList2 : PImageList; Idx2 : Integer; X, Y : Integer ) : PImageList;
Merges two ImageList objects, returns resulting ImageList.
function ExtractIcon( Idx : Integer ) : HIcon;
Extracts icon by index.
function ExtractIconEx( Idx : Integer ) : HIcon;
Extracts icon (is created using current drawing style).
procedure Draw( Idx : Integer; DC : HDC; X, Y : Integer );
Draws given (by index) image from ImageList onto passed Device Context.
procedure StretchDraw( Idx : Integer; DC : HDC; const Rect : TRect );
Draws given image with stratching.
function LoadBitmap( ResourceName : PKOLChar; TranspColor : TColor ) : Boolean;
Loads ImageList from resource.
function LoadIcon( ResourceName : PAnsiChar ) : Boolean;
function LoadCursor( ResourceName : PAnsiChar ) : Boolean;
function LoadFromFile( FileName : PKOLChar; TranspColor : TColor; ImgType : TImageType ) : Boolean;
Loads ImageList from file.
function LoadSystemIcons( SmallIcons : Boolean ) : Boolean;
Assigns ImageList to system icons list (big or small).
function ImageList_Create(CX, CY: Integer; Flags: UINT; Initial, Grow: Integer): HImageList; stdcall;
function ImageList_Destroy(ImageList: HImageList): Bool; stdcall;
function ImageList_GetImageCount(ImageList: HImageList): Integer; stdcall;
function ImageList_SetImageCount(ImageList: HImageList; Count: Integer): Integer; stdcall;
function ImageList_Add(ImageList: HImageList; Image, Mask: HBitmap): Integer; stdcall;
function ImageList_ReplaceIcon(ImageList: HImageList; Index: Integer; Icon: HIcon): Integer; stdcall;
function ImageList_SetBkColor(ImageList: HImageList; ClrBk: TColorRef): TColorRef; stdcall;
function ImageList_GetBkColor(ImageList: HImageList): TColorRef; stdcall;
function ImageList_SetOverlayImage(ImageList: HImageList; Image: Integer; Overlay: Integer): Bool; stdcall;
function ImageList_AddIcon(ImageList: HImageList; Icon: HIcon): Integer;
function Index2OverlayMask(Index: Integer): Integer;
function ImageList_Draw(ImageList: HImageList; Index: Integer; Dest: HDC; X, Y: Integer; Style: UINT): Bool; stdcall;
function ImageList_Replace(ImageList: HImageList; Index: Integer; Image, Mask: HBitmap): Bool; stdcall;
function ImageList_AddMasked(ImageList: HImageList; Image: HBitmap; Mask: TColorRef): Integer; stdcall;
function ImageList_DrawEx(ImageList: HImageList; Index: Integer; Dest: HDC; X, Y, DX, DY: Integer; Bk, Fg: TColorRef; Style: Cardinal): Bool; stdcall;
function ImageList_Remove(ImageList: HImageList; Index: Integer): Bool; stdcall;
function ImageList_GetIcon(ImageList: HImageList; Index: Integer; Flags: Cardinal): HIcon; stdcall;
function ImageList_LoadImage(Instance: THandle; Bmp: PWideChar; CX, Grow: Integer; Mask: TColorRef; pType, Flags: Cardinal): HImageList; stdcall;
function ImageList_LoadImage(Instance: THandle; Bmp: PAnsiChar; CX, Grow: Integer; Mask: TColorRef; pType, Flags: Cardinal): HImageList; stdcall;
function ImageList_BeginDrag(ImageList: HImageList; Track: Integer; XHotSpot, YHotSpot: Integer): Bool; stdcall;
function ImageList_EndDrag: Bool; stdcall;
function ImageList_DragEnter(LockWnd: HWnd; X, Y: Integer): Bool; stdcall;
function ImageList_DragLeave(LockWnd: HWnd): Bool; stdcall;
function ImageList_DragMove(X, Y: Integer): Bool; stdcall;
function ImageList_SetDragCursorImage(ImageList: HImageList; Drag: Integer; XHotSpot, YHotSpot: Integer): Bool; stdcall;
function ImageList_DragShowNolock(Show: Bool): Bool; stdcall;
function ImageList_GetDragImage(Point, HotSpot: PPoint): HImageList; stdcall;
procedure ImageList_RemoveAll(ImageList: HImageList); stdcall;
function ImageList_ExtractIcon(Instance: THandle; ImageList: HImageList; Image: Integer): HIcon; stdcall;
function ImageList_LoadBitmap(Instance: THandle; Bmp: PKOLChar; CX, Grow: Integer; MasK: TColorRef): HImageList; stdcall;
function ImageList_GetIconSize(ImageList: HImageList; var CX, CY: Integer): Bool; stdcall;
function ImageList_SetIconSize(ImageList: HImageList; CX, CY: Integer): Bool; stdcall;
function ImageList_GetImageInfo(ImageList: HImageList; Index: Integer; var ImageInfo: TImageInfo): Bool; stdcall;
function ImageList_Merge(ImageList1: HImageList; Index1: Integer; ImageList2: HImageList; Index2: Integer; DX, DY: Integer): HImageList; stdcall;
function LoadBmp( Instance: Integer; Rsrc: PKOLChar; MasterObj: PObj ): HBitmap;
function LoadBmp32( Instance: Integer; Rsrc: PKOLChar; MasterObj: PObj ): HBitmap;