RoundRect (Delphi)
Description
This example draws many rounded rectangles of various sizes and colors on a form maximized to fill the entire screen.
Code
var
X, Y, DX, DY: Integer;
procedure TForm1.FormActivate(Sender: TObject);
begin
WindowState := wsMaximized;
Timer1.Interval := 50;
Randomize;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
X := Random(Screen.Width - 10);
Y := Random(Screen.Height - 10);
Canvas.Pen.Color := Random(65535);
Canvas.Pen.Width := Random(7);
DX := Random(400);
DY := Random(400);
Canvas.RoundRect(X, Y, X + DX, Y + DY, DX div 2, DY div 2);
end;
Uses
- Vcl.Graphics.TCanvas.RoundRect ( fr | de | ja )
- Vcl.Graphics.TPen.Width ( fr | de | ja )