TPositionedLayer.GetAdjustedLocation

function GetAdjustedLocation: TFloatRect;

Description

When the Scaled property is True, GetAdjustedLocation returns scaled Location, otherwise it returns Location as it is, without scaling.

It is up to you do decide if you want to use the result as a floating-point rectangle, to round the coordinates before painting:

procedure TForm1.OnLayerPaintHandler(Sender: TObject; Buffer: TBitmap32);

var

  R: TRect;

begin

  if Sender is TPositionedLayer then

    with TPositionedLayer(Sender) do

    begin

      R := MakeRect(GetAdjustedLocation);

      Buffer.FrameRectS(R.Left, R.Top, R.Right, R.Bottom, clRed32);

    end;

  end;

end;

See Also

Using Layers, Rectangle Types, GetAdjustedRect, Location, Scaled