如何显示Verticle文本vb.net [英] how to display verticle text vb.net

查看:71
本文介绍了如何显示Verticle文本vb.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的

如何在vb.net中显示文本框或c#

dear
how to display textbox in vb.net or c#

推荐答案

如果您的意思是如何通过以下方式旋转文本框? 90度?然后,除非你使用WPF或编写自己的Textbox替换控件,否则你不能这样做。标准文本框不支持旋转,可能是因为它从未被视为必要的想法。我同意 - 想想你必须使用的穷人用户:他看起来多么简单明了?如果他希望他的文字旋转,他可能会旋转他的桌面 - 很少有显卡司机允许这样做。



个人?我将更改UI设计以使其不必要...
If you mean "how do I rotate a textbox by 90 degrees?" then pretty much, you can't unless you use WPF or write your own Textbox replacement control. The standard textbox does not support rotation, probably because it was never considered as a necessary idea. And I would agree - think about the poor user you has to use this: how simple and obvious will it seem to him? If he wants his text rotated, he will probably rotate his desktop - mosty graphics card drivers allow for that.

Personally? I'd change the UI design to make it unnecessary...


使用 Graphics.RotateTransform 以您希望的方式获得文本旋转。例如:



Use Graphics.RotateTransform to get the text rotation the way you want. For example:

public partial class Form1 : Form {
    public Form1() {
        InitializeComponent();
    }
    protected override void OnPaint(PaintEventArgs e) {
        string text = "Vertical text Example";
        SizeF textSize = e.Graphics.MeasureString(text, this.Font);
        e.Graphics.RotateTransform(-90);
        e.Graphics.DrawString(text, this.Font, Brushes.Black,
            new PointF(-textSize.Width, 0));
    }
}



另见..

代码:在表单上绘制垂直文本(Visual C#) [ ^ ]

绘制垂直字符串文本 [ ^ ]


这篇关于如何显示Verticle文本vb.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆