如何在Windows窗体中支持RichTextBox的垂直对齐? [英] How to support vertical alignment for RichTextBox in windows forms?

查看:81
本文介绍了如何在Windows窗体中支持RichTextBox的垂直对齐?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我们需要支持RichTextBox的垂直对齐。但它没有任何内置属性。请任何人帮忙。我们非常感谢。

We need to support vertical alignment for RichTextBox. But it doesn't have any built in property. Please anybody help on this. We would really appreciate.

对于您的信息,我们使用内置的SelectionAlignment属性来支持水平对齐。

For you information, We used built in SelectionAlignment property to support horizontal alignment.

谢谢和问候,

Hari

点击"建议作为答案"如果这篇文章解决了你的问题或"投票有帮助"如果一篇文章对你有用,快乐编程! Hari

click "Proposed As Answer by" if this post solves your problem or "Vote As Helpful" if a post has been useful to you Happy Programming! Hari

推荐答案

对不起,但RichTextBox根本不支持这样的事情。 你会期待什么? 您是否希望将整个文本置于控件的中心? 您当然可以通过计算内部文本
的大小来模拟它,然后减小控件的大小并将其居中放在窗口中。 但是一旦你开始滚动,文本比窗口长,那么垂直对齐就完全没有意义了。
I'm sorry, but the RichTextBox simply does not support such a thing.  What would you expect it to?  Are you hoping to have the entire text centered within the control?  You can certainly simulate that by figuring out the size of the text inside, then reducing the size of the control and centering it in your window.  But as soon as you start doing scrolling, where the text is longer than the window, then vertical alignment is totally meaningless.


这篇关于如何在Windows窗体中支持RichTextBox的垂直对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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