Thursday, January 13, 2005

Rotating text

private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
string s = ".net works";

e.Graphics.TranslateTransform(this.ClientSize.Width/2,this.ClientSize.Height/2);

for(int a=0;a<10;a++)
{
e.Graphics.DrawString(s,Font,Brushes.Black,50,0,StringFormat.GenericTypographic);
e.Graphics.RotateTransform(36);
}
}

In the above code the origin has been translated to the centre of the screen, and the text is rotated by 30 degrees.

No comments: