| ImageEn, unit imageenview |
|
TImageEnView.FindLayerAt
Declaration
function FindLayerAt(ScrX, ScrY: Integer; SelectablesOnly: Boolean = True; SelectTransparent: Boolean = True; SelectLocked: Boolean = True): Integer;
Description
Returns the index of the layer at position x, y (in client area coordinates).
Layers are only returned if they are
visible (or they are already
selected).
Other parameters:
| Parameter | Description |
| SelectablesOnly | If True, any layer that isn't selectable won't be returned |
| SelectTransparent | If 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 |
| SelectLocked | Special case: If True, and ScrX, ScrY is over a locked layer, the result is -1 (any layers beneath the locked layer are ignored) |
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;