开发者

Changing the orientation of a Win control in VB .Net

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.


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.

  • http://msdn.microsoft.com/en-us/library/system.windows.media.rotatetransform.aspx
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜