HitTest (ImageList Control) example for Delphi
{ Handle MouseDown and MouseUp events as follows}
procedure TForm1.LEADImgList1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
nItem : LongInt;
begin
nItem := LEADImgList1.HitTest(x, y);
If (nItem >= 0) Then
begin
LEADImgList1.SelectionColor := clRed;
LEADImgList1.Item[nItem].Selected := True;
end ;
end ;
procedure TForm1.LEADImgList1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
nItem : LongInt;
begin
nItem := LEADImgList1.HitTest(x, y);
If (nItem >= 0) Then
begin
LEADImgList1.SelectionColor := clBlue;
LEADImgList1.Item[nItem].Selected := True ;
end;
end;