RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCanvas.Arc Method

Draws an arc on the image along the perimeter of the ellipse bounded by the specified rectangle.

Pascal
procedure Arc(X1: Integer; Y1: Integer; X2: Integer; Y2: Integer; X3: Integer; Y3: Integer; X4: Integer; Y4: Integer);
C++
__fastcall Arc(int X1, int Y1, int X2, int Y2, int X3, int Y3, int X4, int Y4);

Use Arc to draw an elliptically curved line with the current Pen. The arc traverses the perimeter of an ellipse that is bounded by the points (X1,Y1) and (X2,Y2). The arc is drawn following the perimeter of the ellipse, counterclockwise, from the starting point to the ending point. The starting point is defined by the intersection of the ellipse and a line defined by the center of the ellipse and (X3,Y3). The ending point is defined by the intersection of the ellipse and a line defined by the center of the ellipse and (X4, Y4).

Note: On Windows 9x or Windows ME, the sums X1 + X2 and Y1 + Y2 cannot exceed 32768. Also, the sum X1 + X2 + Y1 + Y2 cannot exceed 32768.
On NT or Windows 2000, the drawing direction can be changed to clockwise using the Windows API call SetArcDirection.  

C++ Examples: 

 

/*
The following lines of code draw the top quarter of an arc 
bounded by the current window:
*/
void __fastcall TForm1::FormPaint(TObject *Sender)
{
  TRect R = GetClientRect();  // Gets the rectangular
                              // coordinates of 
                              // the current window.
  Canvas->Arc(R.Left, R.Top, R.Right, R.Bottom, R.Right, R.Top, R.Left, R.Top);
}

 

Delphi Examples: 

{
The following lines of code draw the top quarter of an arc 
bounded by the current window:
} 
procedure TForm1.FormPaint(Sender: TObject);
var
  R: TRect;
begin
  R := GetClientRect;   { Gets the boundaries of the current window }
  Canvas.Arc(R.Left, R.Top, R.Right, R.Bottom, R.Right, R.Top, R.Left, R.Top);
end; 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!