使用 FXFont 类

发布于 2024-09-28 03:40:12 字数 51 浏览 1 评论 0原文

如何在 FXRuby 上使用 FXFont 类以便更改应用程序上文本的字体和颜色?谢谢!

how do you use the FXFont class on FXRuby so that you can change the font and color of the text on your application? THANKS!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

往昔成烟 2024-10-05 03:40:12

用于文本的字体或字体是与文本颜色不同的概念。

假设我们正在处理 FXLabel 小部件。如果要更改标签使用的字体,可以使用标签的“font”属性进行设置,例如,

label = FXLabel.new(...)
labelFont = FXFont.new(...)
labelFont.create
label.font = labelFont

另一方面,如果要更改标签的文本颜色,请分配给其“textColor”属性,例如

label.textColor = FXRGB(255, 0, 0)

Hope这有帮助。

The typeface or font used for text is a separate concept from the text color.

Suppose we're dealing with an FXLabel widget. If you want to change the font used for the label, you can set that using the label's "font" attribute, e.g.

label = FXLabel.new(...)
labelFont = FXFont.new(...)
labelFont.create
label.font = labelFont

On the other hand, if you want to change the label's text color, assign to its "textColor" attribute, e.g.

label.textColor = FXRGB(255, 0, 0)

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文