I am attempting to rotate some text within a label. I have a cusom label which allows me to have control over the text rendering process.
protected override void OnPaint ( PaintEventArgs pe )
{
Graphics g = pe.Graphics;
g.RotateTransform( angle );
g.drawString( text );
g.ResetTransform();
}
The problem I am having is that the rotation appears to occur aroundthe origin of the control i.e. co-ordinates (0,0). Is there a method to allow the text to rotate about the center of the control rather than the oragin?
I am aware of the function 'g.RotateTransform( )' so one possible solution would be to rotate the text and then translate it to the centre of the control. If this is the only way to manage the job, is there a generic manner which I can caluclate the transfor to ensure that the text is in the centre of the control?
Thanks