1

##### General / BGRAControls:TBGRAShape

« Last post by**morknotmindy**on

*»*

**Today**at 11:33:46 amI would like to use BGRAShape to rotate a rectangle, keeping its original dimensions, using the Angle property.

I have tried the following:

Set the original BGRAShape.Height to 50, Width to 100 and Angle to 45

Use a trackbar to increment the angle, Min 45 Max 90

In the trackbar onchange event try to adjust the BGRAShape dimensions with

BGRAShape1.Width:=Trunc(50*cos((Trackbar1.Position)*pi/180) + 100*sin(Trackbar1.Position*pi/180));

BGRAShape1.Height:= Trunc((50*sin(Trackbar1.Position)*pi/180) +(100*cos(Trackbar1.Position*pi/180)));

This does not maintain the original dimensions.

Is it possible to achieve what I want and if so is Angle related to the centre point of the shape or the X or Y axis? Is the formula I am using just plain wrong?

Grateful for any advice.

I have tried the following:

Set the original BGRAShape.Height to 50, Width to 100 and Angle to 45

Use a trackbar to increment the angle, Min 45 Max 90

In the trackbar onchange event try to adjust the BGRAShape dimensions with

BGRAShape1.Width:=Trunc(50*cos((Trackbar1.Position)*pi/180) + 100*sin(Trackbar1.Position*pi/180));

BGRAShape1.Height:= Trunc((50*sin(Trackbar1.Position)*pi/180) +(100*cos(Trackbar1.Position*pi/180)));

This does not maintain the original dimensions.

Is it possible to achieve what I want and if so is Angle related to the centre point of the shape or the X or Y axis? Is the formula I am using just plain wrong?

Grateful for any advice.