如何使用 Compact Framework 将文本加粗

发布于 2024-08-29 02:30:53 字数 185 浏览 2 评论 0原文

我有一个用 C# 编写的紧凑框架 (3.5) 的应用程序。

我试图在表单上以粗体显示一些文本。

Label 类没有为我提供将文本加粗的选项(我可以将其放大,最终给出粗体外观,但我希望我的文本为 12pt 且粗体。

这可能吗?如果可以,如何实现?

谢谢你的任何想法。

I have an app written in C# for the compact framework (3.5).

I am trying to display some text on the form in bold.

The Label class does not give me the option to bold my text (I can make it bigger, which eventually gives a bold look, but I want my text 12pt and bold.

Is this possible? If so How?

thanks for any ideas.

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

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

发布评论

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

评论(2

蓝天 2024-09-05 02:30:53

FontStyle 应该适合您

Label1.Font = new Font(Label1.Font, FontStyle.Bold);

FontStyle should work for you

Label1.Font = new Font(Label1.Font, FontStyle.Bold);
苦妄 2024-09-05 02:30:53

您可以在设计时完成;)

在 Visual Studio 中,您可以扩展字体属性,以公开名称、字体和样式属性。
您也可以添加 ; style=bold 在 Visual Studio 中的字体属性之后。 (或任何与此相关的风格)。

如果您继续使用上面的代码,我建议处理旧字体,以防止内存泄漏

You can do it designtime ;)

In visual studio you can extend the font property, to expose the name, font and style property.
Also you can add ; style=bold after the font property in visual studio. (or any style for that matter).

If you keep using the code above, i recommend disposing the old font, to prevent a memory leak

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