DelphiDabbler Code Snippets Database

Snippet Selection

The following snippets from the Code Snippets Database have been requested.

BoundsF

Constructs and returns a TRectF record with the given top-left coordinate, width and height.

function BoundsF(ALeft, ATop, AWidth, AHeight: Double): TRectF;
begin
  Result.Left := ALeft;
  Result.Top := ATop;
  Result.Right := ALeft + AWidth;
  Result.Bottom :=  ATop + AHeight;
end;

PointF

Constructs and returns a TPointF record with the given x & y coordinates.

function PointF(const AX, AY: Double): TPointF;
begin
  Result.X := AX;
  Result.Y := AY;
end;

RectF

Constructs and returns a TRectF record with the given left, top, right & bottom coordinates.

function RectF(const ALeft, ATop, ARight, ABottom: Double): TRectF;
begin
  Result.Left := ALeft;
  Result.Top := ATop;
  Result.Right := ARight;
  Result.Bottom := ABottom;
end;

TPointF

Encapsulates a point with double precision floating point coordinates.

type
  TPointF = record
    X, Y: Double;  // x and y coordinates
  end;

TRectF

Encapsulates a rectangle with double precision floating point size and position.

type
  TRectF = record
    case Integer of
      0: (Left, Top, Right, Bottom: Double);
      1: (TopLeft, BottomRight: TPointF);
  end;

View the whole database.

Go to the DelphiDabbler website.