how to draw a circle

how to draw a circle

Post by ronan van rie » Wed, 15 Jul 1998 04:00:00



All,

I've a short question. How do I draw a circle on my form?

I know that a circle is a special type of ellipse, but when trying to
draw one I set the the circle's center to let's say (100, 100).

Anyone have an example of doing this ?

Ronan van Riet

 
 
 

how to draw a circle

Post by Kerstin Thale » Wed, 15 Jul 1998 04:00:00



> All,

> I've a short question. How do I draw a circle on my form?

> I know that a circle is a special type of ellipse, but when trying to
> draw one I set the the circle's center to let's say (100, 100).

> Anyone have an example of doing this ?

> Ronan van Riet


Hi Ronan,

it depends of the way you want to draw the circle. Here is an example
for the case you have a special radius:

procedure TForm1.DrawTheCircle(Canvas: TCanvas; radius: Integer; P:
TPoint);
begin
  Canvas.Ellipse(P.x - radius, P.y - radius, P.x + radius, P.y +
radius);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  DrawTheCircle(Canvas, 30, Point(100, 100));  
end;

or if you want to use the OnMouseUp event to set the center of the
circle you can doit like this:

procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  DrawTheCircle(Canvas, 30, Point(x, y));  
end;

Good luck!

Kerstin

 
 
 

how to draw a circle

Post by Josef Garv » Wed, 15 Jul 1998 04:00:00


Try

Buffer.Canvas.Ellipse(CenterX - radius, CenterY - radius, CenterX +
radius, CenterY + radius);


> All,

> I've a short question. How do I draw a circle on my form?

> I know that a circle is a special type of ellipse, but when trying to

"Special"... It's just a 'square' ellipse, meaning it has the same
height and width.

> draw one I set the the circle's center to let's say (100, 100).

> Anyone have an example of doing this ?

> Ronan van Riet


--
Josef Garvi
Eden Foundation, Skreav. 45B, S-311 72 Falkenberg, Sweden
Tel: +46 346-53157, Fax: +46 346-53171

WWW: http://www.eden-foundation.org/
 
 
 

1. How to draw a circle with the PostScript curveto operator

The subject says it all.
How do I draw a circle with the PS curveto operator ?
This is the way Adobe Illustrator draws circles, but when I try do do it
the same way, I obtain circles which seem slightly distorted.

Thanks,
Jean

--
Jean Thioulouse - Laboratoire de Biometrie - Universite Lyon 1
69622 Villeurbanne CEDEX - France        Fax: (33) 78 89 27 19

2. VR journal seeks software reviewers

3. Wanted: Fastest way to draw a circle.

4. more on Lightwave 6.5 explosions...

5. How can I draw a circle?

6. 3D Viewing parameters from Foley & VD, etc.

7. Bitmap mode, drawing a circle or elipse

8. PSP 6 & 7 tubes compatibility?

9. how to draw a circle ??

10. How do I draw a circle?

11. How to draw a circle

12. How do you draw a circle?