我编写了一个 C# 小程序,它时不时地在气球提示中显示文本。
当文本是英文时,没有问题:所有内容都向左对齐并且可读,但有时我有一些希伯来语文本,而 RTL 语言的左对齐会变得很奇怪。
我想知道是否有办法右对齐希伯来语文本?
谷歌向我指出了可以帮助我更改气球颜色和字体的文章,但它们都没有对齐参数。
有可能吗?
任何帮助都将被适当。
约翰
I wrote a little C# program that displays text in a balloon tip from time to time.
When the text is in English, there's no problem : Everything is aligned to the left and is readable, but sometimes I have some Hebrew text and a left alignment of a RTL language gets all screwy.
I was wondering if there's a way to right-align the Hebrew text ?
Google pointed me to articles that can help me change the balloon color and font, but none of them have an alignment argument.
Is it even possible ?
Any help will be appropriated.
John
发布评论
评论(2)
WF ToolTip 控件使用窗体的 RightToLeft 属性来确定如何对齐其文本。当您有一个从左到右显示文本的表单时,显示 RTL 文本是一个不寻常的要求,本课程未涵盖。在显示提示之前将窗体的 RightToLeft 属性设置为 Yes 看起来不太令人愉快。
另一种方法是通过将工具提示的 OwnerDraw 属性设置为 True 来使用自定义绘图。 MSDN 库</a>。您需要使用 TextFormatFlags.RightToLeft。
The WF ToolTip control uses the form's RightToLeft property to determine how to align its text. Displaying RTL text when you have a form that otherwise displays text left to right is an unusual requirement, not covered by the class. Setting the form's RightToLeft property to Yes before you display the tip isn't going to look very pleasant.
The alternative is to use custom drawing by setting the tool tip's OwnerDraw property to True. A good example for a Draw event handler is available in the MSDN Library. You'll want to use TextFormatFlags.RightToLeft.
我成功地自定义了从右到左的工具提示,但是有没有办法为 BalloonTip 做到这一点?
由于我忘记在第一篇文章中提及它,所以我的程序是一个标准的 WinForms 程序。
I successfully managed to custom draw a right to left tooltip, but is there a way to do it for a BalloonTip ?
And since I forgot to mention it in my first post, My program is a standard WinForms program.