ImageEn, unit imageenview |
|
TImageEnView.FindLayerAt
Declaration
function FindLayerAt(ScrX, ScrY: Integer; SelectablesOnly: Boolean = true; SelectTransparent: Boolean = True): Integer;
Description
Returns the index of the layer at position x, y (in client area coordinates).
If SelectablesOnly is true, it won't return any layer which isn't selectable.
If SelectTransparent is true, the layer will be returned even if ScrX, ScrY are over a transparent part of the layer. If False, ScrX, ScrY must be over a visible part of the layer.
Returns -1 if no layer was found.
Example
// Show which layer is under the cursor
procedure TMainForm.ImageEnView1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
lyr: Integer;
begin
lyr := ImageEnView1.FindLayerAt( X, Y );
if lyr < 0 then
lblLayer.Caption := 'Layer: None'
else
lblLayer.Caption := 'Layer: ' + IntToStr( lyr );
end;