Groups | Blog | Home
all groups > dotnet drawing api > october 2003 >

dotnet drawing api : How to draw rotated text?


faustino Dina
10/13/2003 2:55:11 PM
Hi,

I was looking on the SDK but I can't find how to draw text in angles
different from 0 and 90. Is it possible? If not, does exist some 3rd party
library allowing this? Any hint is welcomed

Thanks in advance
Faustino

Girish Bharadwaj
10/13/2003 3:56:57 PM

Try using Graphics.DrawPath() or FillPath() methods. Look at help for
GraphicsPath.AddString() that might help you out..



--
Girish Bharadwaj
[quoted text, click to view]

James Westgate
10/13/2003 9:30:11 PM
Hi,

To rotate text at a location, follow these steps

1 - Do a translate transformation to the location of your text
2 - Do a rotate transform through the required angle
3 - Write the text as normal using drawstring

The following code should help you, it assumes that there are no prior
transformations

objGraphics.TranslateTransform(X, Y)
objGraphics.RotateTransform(.Rotation)
objGraphics.DrawString(Text, Font, objBrush, 0, 0, .StringFormat)

James
--
Create interactive flowcharts, diagrams and UML models with ERM3 at
http://www.crainiate.net



[quoted text, click to view]

Bob Powell [MVP]
10/14/2003 1:36:42 AM
The GDI+ FAQ has the answer.

--
Bob Powell [MVP]
C#, System.Drawing

September's edition of Well Formed is now available.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Blog http://bobpowelldotnet.blogspot.com

[quoted text, click to view]

Elango.D
10/17/2003 2:26:44 AM
Give in paint and c the output,

Matrix myMatrix = new Matrix();
myMatrix.Rotate(270, MatrixOrder.Append);
e.Graphics.Transform = myMatrix;
e.Graphics.DrawString("VerticalText", font,
Brushes.Blue, -90, 0);

change the rotate degree and DrawString's
AddThis Social Bookmark Button