Link to home
Start Free TrialLog in
Avatar of ItsMe
ItsMe

asked on

TCanvas.Circle

Hi,
I need a procedure which draws a circle. The Code should be
procedure circle (x,y,r : Integer) x,y = Middle r = radius.
ASKER CERTIFIED SOLUTION
Avatar of dwwang
dwwang

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here is something for ya...

procedure Circle(x,y, r : Integer; Where : TCanvas);
var
  a : integer;
begin
  for a := 0 to 359 do
    Where.Pixels[round(x+cos(a/180*pi)*r),round(y+sin(a/180*pi)*r)] := clBlack;
end;

Example call:

Circle(Form1.Width shr 1, Form1.Height shr 1, 50, Form1.Canvas);

Hope this helps...

-Viktor
--Ivanov
Which comment answer helped you solve your problem?? I'm just curious...
Avatar of ItsMe
ItsMe

ASKER

No one. I took a cheat of paper, draw a rectangle with a circle and thought that I only have to find out the radius to solve my problem. I knew the mouse up point and from this point i ad to go radius left and radius right and up and down the same.
(:-)
That would take quite a long time to accomplish... You need to change the Xs and Ys in order to be able to do it that way, and it really is a cheap way of doin' it...

Merry Christmas!

Take care o' ya

-Viktor
--Ivanov