ImageEn, unit iemview

TImageEnMView.ImageAtPos

TImageEnMView.ImageAtPos


Declaration

function ImageAtPos(x, y: Integer; checkBounds: Boolean = true): Integer;


Description

Use ImageAtPos to determine which image exists at the specified location within the control.
The x, y parameters specify the position in "client coordinates".
If checkBounds is True, thumbnail bounds are checked to ensure that we are positioned within the thumbnail area (Specifying False is useful for finding the nearest thumbnail).

If there is no thumbnail at the specified position, ImageAtPos returns -1.


Example

// Display the file name in the status bar for the image under the cursor
procedure TForm1.ImageEnMView1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  // Note: ImageFileName[] will return '' if -1 is passed
  StatusBar1.SimpleText := ImageEnMView1.ImageFileName[ ImageEnMView1.ImageAtPos(x, y) ];
end;