//聲明:
Rectangle(
DC: HDC; {設備環境句柄}
X1, Y1, X2, Y2: Integer {兩個點的坐標}
): BOOL;
//舉例:
procedure TForm1.FormPaint(Sender: TObject);
const
x1 = 20;
y1 = 20;
x2 = 200;
y2 = 100;
begin
Rectangle(Canvas.Handle, x1,y1, x2,y2);
end;
//效果圖: