# Rotate shape

How can you after you place a shape (a rectangle in this case)on a form when designing the form and rotate it by 45 degrees and then 90 degrees at run time?
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Check out this microsoft article:

HOWTO: Rotate a Bitmap Image in 90-Degree Increments
http://support.microsoft.com/support/kb/articles/Q186/2/60.ASP?LNG=ENG&SA=MSDN

Cheers!
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Commented:
If you need to rotate a shape by an arbitrary angle, you are probably better off using the Polygon API and translating the points according to the angle.
0
Commented:
Yes.

From your other question you can glean how you can actually create the polygon with the API, so I assume that is a known quantity.

Simply refer to the points of the polygon with their carthesian coordinates wrt an origin. Each point has coordinates (x, y)

If you rotate a point through an angle Alpha wrt the origin, its new coordinates will become
(x*cos(Alpha) - y*sin(Alpha), x*sin(Alpha) + y*cos(Alpha))

(I think - check it)

Simply re-calculate all the POINTs in your polygon and redraw.
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.