向GraphicsPath添加字符串并绘制GraphicsPath会降低绘制字符串的质量吗? [英] Adding a string to GraphicsPath and drawing the GraphicsPath reduce the quality of the drawn string?

查看:189
本文介绍了向GraphicsPath添加字符串并绘制GraphicsPath会降低绘制字符串的质量吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



你知道任何改变的选项可以更好地工作(比如DrawString()可以做的)吗?



谢谢!



VipHaLong。

解决方案

你真的不需要将字符串表示为图形路径正确的转换。使用 System.Drawing.Graphics.Transform 完成转换:

http://msdn.microsoft.com/en-us/library/system.drawing.graphics.transform.aspx [< a href =http://msdn.microsoft.com/en-us/library/system.drawing.graphics.transform.aspxtarget =_ blanktitle =New Window> ^ ],

http:// msd n.microsoft.com/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:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.transform.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.matrix.aspx[^].

—SA


这篇关于向GraphicsPath添加字符串并绘制GraphicsPath会降低绘制字符串的质量吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆