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:
- Where we must write the character.
- Angle of the letter with the axis.
- Path of the string.
- 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.
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:
How the text must be displayed. Three methods are supported in
Label. They are
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.
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.
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.