向GraphicsPath添加字符串并绘制GraphicsPath会降低绘制字符串的质量吗?

编程入门 行业动态 更新时间:2024-10-24 12:22:18
本文介绍了向GraphicsPath添加字符串并绘制GraphicsPath会降低绘制字符串的质量吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

DrawString()方法给出了一个非常好的结果,当您在文本框中键入文本/字符串时,它会被清晰地绘制出来。然而,我尝试了另一种方式(顺便说一句),但它表现出不好的外观。我需要这样做,因为我想首先对字符串应用一些转换(例如旋转)。我的方法是创建一个GraphicsPath,使用AddString()方法向该GraphicsPath添加一些字符串,然后使用DrawPath()绘制该字符串。绘制的字符串看起来非常难看(我没有指定粗体字体,但它似乎受到大胆风格的影响,字符串就像模糊,......它真的不是我想要的。 你知道任何改变的选项可以更好地工作(比如DrawString()可以做的)吗? 谢谢! VipHaLong。

解决方案

你真的不需要将字符串表示为图形路径正确的转换。使用 System.Drawing.Graphics.Transform 完成转换: msdn.microsoft/en-us/library/system.drawing.graphics.transform.aspx [ ^ ], http:// msd n.microsoft/en-us/library/system.drawing.drawing2d.matrix.aspx [ ^ ]。
-SA

The method DrawString() gives out a very nice result, the text/string is drawn clearly as you type it into a textbox. However I tried another way (a by-way) but it showed a bad appearance. I need to do this way because I want to apply some transformations to the string first (such as rotating). The way I did is creating a GraphicsPath, using AddString() method to add some string to that GraphicsPath, then using DrawPath() to draw that string. The drawn string looked very ugly (I didn''t specify a bold font but it seemed to be affected by bold style, the string was like as blurred, ... it was really not what I want. Do you know any options to change for this to work better (like DrawString() can do)? Thank you! VipHaLong.

解决方案

You don''t really need to represent a string as a graphic path for proper transform. Transformations are done using System.Drawing.Graphics.Transform: msdn.microsoft/en-us/library/system.drawing.graphics.transform.aspx[^], msdn.microsoft/en-us/library/system.drawing.drawing2d.matrix.aspx[^].
—SA

更多推荐

向GraphicsPath添加字符串并绘制GraphicsPath会降低绘制字符串的质量吗?

本文发布于:2023-08-01 08:53:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1267015.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   质量   GraphicsPath

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!