Click to See Complete Forum and Search --> : vertical text


Schirrmeister
May 5th, 2003, 10:07 AM
Hi,

how can i rotate a text (label) 90 degrees in Visual Studio, like the vertical tabs(e.g. Toolbox on the left)?

Thanx in advance

Schirr

pareshgh
May 5th, 2003, 12:41 PM
you will need to have the Paint Method overloaded and write the text manually.

-Paresh

Schirrmeister
May 5th, 2003, 02:46 PM
Thx, but that sounds too hard for me, as i'm relative new to programming.
So, if anyone knows an easier way, i would be very grateful.

Schirr

radlradl
May 6th, 2003, 05:05 PM
Here's some sample code to work with:


this.Paint += new PaintEventHandler(DrawTab);


Private void DrawTab()
{
base.OnPaint();

Graphics g = this.CreateGraphics();
g.Clear(this.BackColor);

g.DrawString( "hello world",
this.Font,
new SolidBrush(this.ForeColor),
0, 0,
new StringFormat(StringFormatFlags.DirectionVertical));
}

pareshgh
May 6th, 2003, 05:33 PM
see there you go.. thanks for the sample. was bit lazy for overriding the paint :D :D

Schirrmeister
May 7th, 2003, 02:35 AM
Thx a lot for the sample, on my own i'd never get that, i'm still learning the language and i don't know what's possible.

:)

pareshgh
May 7th, 2003, 05:08 PM
no problem, post your problem and someone will definitely solve it ;) :cool: