Solved

TCanvas.Circle

Posted on 1998-12-20
5
229 Views
Last Modified: 2010-04-04
Hi,
I need a procedure which draws a circle. The Code should be
procedure circle (x,y,r : Integer) x,y = Middle r = radius.
0
Comment
Question by:ItsMe
  • 3
5 Comments
 
LVL 4

Accepted Solution

by:
dwwang earned 0 total points
ID: 1352156
TCanvas.Ellipse(X1, Y1, X2, Y2: Integer);

According to you requirement,
X1:=x-r;
Y1:=y-r;
X2:=x+r;
Y2:=y+r;
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1352157
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
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1352158
Which comment answer helped you solve your problem?? I'm just curious...
0
 

Author Comment

by:ItsMe
ID: 1352159
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.
(:-)
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1352160
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
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question