How to draw rotated text?

I’m extending a line graph control (Tinkr2) to have an X and Y axis title (also added grids). How do I create text and then rotate it -90 degrees for the Y axis? I see that there is a rotate component in SPOT.Bitmap however I must pass a bitmap into it…? How to get a bitmap out of text?

I can draw the Y axis title letter by letter going in the top down direction, however it does not look very good due to differing character widths so I need to rotate the text. Thanks for any help.

David

You have to draw the text onto a bitmap, rotate that bitmap and then draw it into your main bitmap. This is why Tinkr code doesn’t support it.

This is a good question. Nowadays rotated text is taken for granted. I remember the days when it required HTML hacks and IE specific functions to draw vertical text in a web browser.

Isn’t there a graphics library for .NETµ?

Disappointing… I will have to make due with vertical text then.

@ Guerillah - cant you just turn the screen sideways :smiley:

When you draw char by char you could go DrawTextInRect to make sure they’re at least center aligned…

@ MRTEFREN I settled on turning my head sideways instead.

@ Skewworks Thanks for the tip!