简体   繁体   English

我可以在C#气球提示中对齐文本吗?

[英]Can I align the text in a C# balloon tip?

I wrote a little C# program that displays text in a balloon tip from time to time. 我编写了一个小C#程序,该程序会不时在气球提示中显示文本。 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. 当文本为英语时,没有问题:一切都向左对齐并且可读,但是有时候我有一些希伯来语文本,而RTL语言的左对齐则很麻烦。 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. Google向我指出了一些可以帮助我更改气球颜色和字体的文章,但是它们都没有对齐参数。

Is it even possible ? 可能吗?

Any help will be appropriated. 任何帮助将是适当的。 John 约翰

The WF ToolTip control uses the form's RightToLeft property to determine how to align its text. WF ToolTip控件使用窗体的RightToLeft属性来确定如何对齐其文本。 Displaying RTL text when you have a form that otherwise displays text left to right is an unusual requirement, not covered by the class. 当您有一个窗体时,以其他方式从左到右显示文本时,显示RTL文本是一个不寻常的要求,该类未涵盖。 Setting the form's RightToLeft property to Yes before you display the tip isn't going to look very pleasant. 在显示提示之前,将表单的RightToLeft属性设置为Yes看起来不会很愉快。

The alternative is to use custom drawing by setting the tool tip's OwnerDraw property to True. 另一种方法是通过将工具提示的OwnerDraw属性设置为True来使用自定义绘图。 A good example for a Draw event handler is available in the MSDN Library . MSDN Library中提供了Draw事件处理程序的一个很好的示例。 You'll want to use TextFormatFlags.RightToLeft. 您将要使用TextFormatFlags.RightToLeft。

I successfully managed to custom draw a right to left tooltip, but is there a way to do it for a BalloonTip ? 我成功地自定义了从右到左的工具提示,但是对于BalloonTip ,有没有办法做到这一点 And since I forgot to mention it in my first post, My program is a standard WinForms program. 由于我在第一篇文章中忘了提及它,因此我的程序是标准的WinForms程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM