2
Reply

Can I rotate a panel?

Sascha B

Sascha B

Dec 6 2010 7:15 AM
11.9k
Hi,

I want to split my panel in 8 parts so I created this little code
 // drawarea = Panel and aktTab = latest Index

float x0 = drawarea[aktTab].Width / 2, y0 = drawarea[aktTab].Height / 2, x1, y1;
for (double i = 1; i < 8; i++)
{
double winkel1 = Math.PI / 2 - i * 2 * Math.PI / 8;
x1 = (float)(x0 + drawarea[aktTab].Width * 1 * Math.Cos(winkel1));
y1 = (float)(y0 - drawarea[aktTab].Width * 1 * Math.Sin(winkel1));
grafik.DrawLine(new Pen(Color.Black), x1, y1, drawarea[aktTab].Width - x1, drawarea[aktTab].Height - y1);
}


I'm very proud of me getting this working :) Now it looks like this. You can ignore the eclipse and those dots.

http://img525.imageshack.us/i/image1qy.png/

22,5° rotated. Now how can I do this?... Think it's not so difficult but I'm stucked.
What should I change in my code to get this?
Hope you can help me.

Answers (2)