Click here to Skip to main content
Click here to Skip to main content

Customized Text - Orientated Controls in C# - Part I (Label Control)

, 26 Sep 2004
Rate this:
Please Sign up or sign in to vote.
Label which can display text in any orientation and shape.

Sample Image - customtext.jpg


There are many ways in which text can be displayed. But most common ways are showing it in the path of straight line, arc, and circle. The Label which comes with NET can only display the text in the path of a straight line. This control can do that in all the main three methods, with rotation angle. Also, text can be displayed in a direction which we are interested in.

How it Works

There are a few points we must take care about, before we write:

  1. Where we must write the character.
  2. Angle of the letter with the axis.
  3. Path of the string.
  4. Direction of the string.

According to our needs, we can override the control's OnPaint method and draw the text. We must draw the text on our own using Graphics object. It has very useful methods which can be used here. TranslateTransform and RotateTransform are the common methods used to achieve this task. TranslateTransform is used to move the text, where we want it to be displayed. The other method is to rotate the character to orientate it with center.

The control has three properties, which can be used:

  • TextOrientation

    How the text must be displayed. Three methods are supported in Label. They are Rotate, Arc and Circle. We can display it in a straight line with rotation. I mean, the text will be displayed in a straight path, but the text can be rotated in any angle we want. The other is Arc, in which we can display a text in arc shape. The last one is, displaying it in circular path.

  • TextDirection

    There are two ways, which direction we want to display text when we think about displaying it in arc's path or circular one. They are clockwise and anticlockwise.

  • RotationAngle

    Text can be rotated in any angle we like. This can be mostly done in straight line.


My plan is to write custom controls in which we can rotate the text. In future, according to the feedback I get from this, I will write more custom controls where we can do text oriented works.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Chester Ragel
Web Developer
Singapore Singapore
No Biography provided

Comments and Discussions

GeneralMy vote of 5 PinmemberMetafunken23-Apr-14 21:30 
QuestionMy Vote of 5 PinmemberMetafunken23-Apr-14 21:29 
QuestionOK, but what about printing? Pinmembernikonation6-Feb-14 22:55 
GeneralMy vote of 5 PinmemberGopinaath Manokaran20-Feb-13 22:54 
Questionalignment problem Pinmemberamolpbhavsar18-Oct-11 2:27 
GeneralText gets messed up when using it in other user control with scrollbox... PinmemberNicklez28-Feb-11 4:06 
Using modified label class I've managet to put it into tableLayoutPanel. However if tableLayoutPanel grows in size (many rows)
header row before I use vertical or horizontal scrollbar is ok. After I scroll down and then up to the top text gets messed up - double letters, text is painted above previous. I have suspision that this have somthing to do with OnPaint method. Seems like some kind of refresh functionality is needed. Confused | :confused:
GeneralRe: Text gets messed up when using it in other user control with scrollbox... PinmemberSteveproject25-Jun-11 2:32 
GeneralWinCE Compact framework Pinmemberarunmuthu13-Oct-10 3:25 
GeneralThanks Pinmemberarapillai9-Nov-09 1:14 
GeneralSimple/Perfect. Thank you! PinmemberDouglas Berry9-Oct-08 6:28 
GeneralYes I love it. PinmemberV# Guy23-Jun-08 2:39 
GeneralRe: Yes I love it. PinmemberAhmad993-Sep-08 20:22 
QuestionHow to modify this control for web forms. PinmemberAhmad994-Jun-08 4:01 
AnswerRe: How to modify this control for web forms. PinmemberElliott Ortiz12-Oct-09 7:17 
GeneralLabelled Textbox PinmemberChakreee8-Sep-06 5:00 
Generalmake it support colors PinmemberTheCardinal11-Aug-06 13:30 
GeneralI need rtf codes to include picture PinsussAnonymous10-Oct-05 9:55 
QuestionGreat Control, but... Pinmemberlgbjr20-Sep-05 22:01 
GeneralEntryPoint Question PinsussAnonymous11-Jun-05 7:39 
GeneralI need help PinmemberTomek Frykas11-Jun-05 6:18 
GeneralProblems with alignement Pinmemberdscemama13-Apr-05 3:32 
GeneralRe: Problems with alignement Pinmemberdscemama13-Apr-05 4:13 
GeneralRe: Problems with alignement Pinmemberlowrider196815-Dec-05 3:36 
GeneralRe: Problems with alignement Pinmemberni123452-Nov-10 10:20 
GeneralJust what I was looking for! PinmemberCCosgrove18-Feb-05 6:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150414.1 | Last Updated 27 Sep 2004
Article Copyright 2004 by Chester Ragel
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid