Sign in Join
FPDoc Onlineexperiment

TCanvas.RoundRect procedure

Member of TCanvaspublicIn unit Graphics

Draws a rectangle with rounded corners at the specified position.

Declaration

pascal
procedure RoundRect(X1: Integer; Y1: Integer; X2: Integer; Y2: Integer; 
 RX: Integer; RY: Integer); virtual
procedure RoundRect(const Rect: TRect; RX: Integer; RY: Integer)

Description

RoundRect is an overloaded method in TCanvas used to draw a rectangle with rounded corners. The overloaded variants allow the coordinates to be specified as either:

  • Four separate Integer values representing the position of the top, left, bottom, and right edges of the shape (X1, Y1, X2, Y2).
  • A TRect instance where the vertices are represented as either four Integers, two TPoint instances for TopLeft and BottomRight, or a vector using the TArray4IntegerType (Rect).

RX and RY contain the width and height (respectively) for an ellipse used to draw arc segments for the rounded corners on the rectangular shape.

RoundRect (like Rectangle) draws an outline (or borders) for the shape using the mode, style and width defined in Pen. The rounded rectangle is also filled using the style, color and/or bitmap defined in Brush.

RoundRect calls the routine in the LCL interface used to implement the method for the current widgetset.

See also

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.