views:

74

answers:

1

I need to allow the user to rotate a control (the control inherits from a TextBox) in 90 degree increments so the text can be read from either side, or even upside down.

I'm guessing I could override the control's paint event and just paint it in the orientation that I want, but I'm just wondering if there's a quicker/built-in way?

This is a WinForms project. Sorry for not specifying.

+2  A: 

Is this a WinForms or WPF project?

In WinForms this is not easy to accomplish. It is possible to do by overriding Paint or using a fake Image. But likely this is not going to be worth your effort as their will be a lot of odd corner cases that will be missed.

In WPF this can be accomplished by applying a RotateTransform to a given object. Here is the documentation on this type and their are many tutorials available online for this sort of thing.

JaredPar
Unfortunately it is WinForms and I'm required to have the ability to rotate (program requirements are: make a program to replace LabelView across the whole company). This project should be in WPF, but company policy prohibits it.
smoore