如何使用 Graphics.DrawString 绘制双倍高度文本?

发布于 2024-07-11 10:26:10 字数 158 浏览 9 评论 0原文

我正在尝试使用 System.Drawing 模拟 POS 打印机,我需要的功能之一是以双倍高度绘制文本。 知道如何使用 .Net 的 Graphics 类来做到这一点吗?

我需要将文本绘制两倍大并压缩它还是绘制正常大小然后拉伸? 两者似乎都是混乱的选择,但还有其他选择吗?

I am trying to emulate a POS printer with System.Drawing and one of the functions I need is to draw text at double height. Any idea how I can do this using .Net's Graphics class?

Do I need to draw the text twice as large and condense it or draw normal size and then stretch? Both seem like messy options but is there an alternative?

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

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

发布评论

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

评论(2

肤浅与狂妄 2024-07-18 10:26:10

查看 Graphics 对象上的变换矩阵 - 您可以独立控制水平和垂直缩放。

Look at the transformation matrix on the Graphics object - you can control horizontal and vertical scaling independently.

那小子欠揍 2024-07-18 10:26:10

使用 ScaleTransform 并仅放大 y。

Use a ScaleTransform and only scale up the y.

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