CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: vertical text

  1. #1
    Join Date
    Apr 2003
    Location
    Berlin
    Posts
    8

    vertical text

    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
    Attached Images Attached Images

  2. #2
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    you will need to have the Paint Method overloaded and write the text manually.

    -Paresh
    - Software Architect

  3. #3
    Join Date
    Apr 2003
    Location
    Berlin
    Posts
    8
    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

  4. #4
    Join Date
    Jul 2000
    Location
    Pasadena, CA
    Posts
    18

    pareshgh is right, but it isn't that hard.

    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));
    }
    Last edited by radlradl; May 6th, 2003 at 05:08 PM.

  5. #5
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    see there you go.. thanks for the sample. was bit lazy for overriding the paint
    - Software Architect

  6. #6
    Join Date
    Apr 2003
    Location
    Berlin
    Posts
    8

    Thumbs up

    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.


  7. #7
    Join Date
    Nov 2002
    Location
    Singapore
    Posts
    1,890
    no problem, post your problem and someone will definitely solve it
    - Software Architect

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured