Description : We can rotate the text by giving angel. We can rotate the text simply override the onPaint event The Following is the code for rotating the text.
protected override void OnPaint(PaintEventArgs e) { Graphics MyGraphics = e.Graphics; MyGraphics.FillRectangle(Brushes.White, this.ClientRectangle); Font MyFont = new Font("Times New Roman", 24); MyGraphics.DrawString("The Text for rotate", MyFont, Brushes.Black, 0, 0); MyGraphics.RotateTransform(45); MyGraphics.TranslateTransform(150, 0); MyGraphics.DrawString("The Text for rotate", MyFont, Brushes.Black, 0, 0); }
Code Explanation
1. Create the instance of the Graphics 2. Fill it with rectangle 3. Create the instance of the Font 4. Write the text in the instance of the Graphics 5. Rotate the string by giving the angle. 6. Draw the string again
By Nathan
|
No responses found. Be the first to respond and make money from revenue sharing program.
|