Solved

TCanvas.Circle

Posted on 1998-12-20
5
224 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now