Vertical Label in WinForms

Posted by: abel.perez on 14 May 2019, 7:21 pm EST

    • Post Options:
    • Link

    Posted 14 May 2019, 7:21 pm EST

    Does the WinForms suite provide a label control that can be set at various angles including vertical?

  • Posted 16 May 2019, 6:12 am EST

    Hi,

    There is no label control that supports Text rotation. Most of the controls do have their own methods to draw rotated text (like rotating text using Styles).

    If you want to implement vertical text label then you can override the label’s OnPaint event and draw the string (using StringFormatFlags.DirectionVertical enum).

    Please refer the attached sample for an example.

    Regards,

    Jitender

    LabelRotate.zip

  • Posted 16 May 2019, 7:04 pm EST

    OnPaint event was what i was trying to avoid. Thanks for the sample though.

  • Posted 16 May 2019, 11:46 pm EST

    Hi,

    There is no other way to do this. Since the normal rendering is horizontal, we would need to override this in OnPaint.

    Regards,

    Jitender

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels