HitTest(ImageList Control) example for C++ Builder
/* Handle MouseDown and MouseUp events as follows*/
void __fastcall TForm1::LEADImgList1MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
long nItem ;
nItem = LEADImgList1->HitTest(X, Y);
if( (nItem >= 0))
{
LEADImgList1->SelectionColor = clRed;
LEADImgList1->Item[nItem]->Selected = True;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::LEADImgList1MouseUp(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
long nItem ;
nItem = LEADImgList1->HitTest(X, Y);
if( (nItem >= 0))
{
LEADImgList1->SelectionColor = clBlue;
LEADImgList1->Item[nItem]->Selected = True ;
}
}