We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Draw a rotating line on a canvas

Medium Priority
Last Modified: 2013-11-22

This is a hard one.

I am drawing the TCanva of a form using "Pixels [x, y] := MyColor;"

For example:
- Drawing area is 400x400 pixel starting at position 0,0.
- Draw a line from the center of the area (pos:200,200).
- Line length is half of area size 200 pixels (so it will never touch the corners...)
- Line width is always 1 pixel
Where it gets hard:
- The line color is diferent for each pixel
- The drawing area can change size
- I want to draw the line using radians
- I want to draw the line from center outward (so if the line is 200 pixels, pixel #1 is on center and #200 is at the end of the line)

Radians, pixel number, and color values come from a database. but for the purpouse of this project lets just assign a random value.

Hope you guys can help..
Watch Question


Just to be cleared:

I want to call a function like

DrawAngleLine( RadValue)
Could also be in degrees, id doesn't mather
The tough part is figuring which pixels are to be drawn at a given angle...

X=Radius * COS(angle)
Y=Radius * SIN(angle)

The rest is self explanatory...

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.