Solved

TCanvas.Circle

Posted on 1998-12-20
5
232 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi component that can load a DLL in design time? 8 93
DBGrid or StringGrid ? 6 120
Not able to call Delphi XE10 dll function from Delphi 6.0 4 48
IP without any Dots 1 59
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

733 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