Vb.Net应用程序从头开始创建一个位图,并转换为tiff或将其发送到打印机.在这两种情况下,图像的质量(在这种情况下是字体)都不是很好.下面列出的示例代码创建了我用来写入图像的图形对象.
Dim gr2 As Graphics = Graphics.FromImage(New Bitmap(800,1000),Imaging.PixelFormat.Format32bppPArgb))
除了@durilai说你可能想要提出解决方案,如果你打算打印. .Net使用的系统分辨率通常为96 DPI,但打印机可以使用300 DPI或更高的文件.
'Create a new bitmap Using Bmp As New Bitmap(800,1000,Imaging.PixelFormat.Format32bppPArgb) 'Set the resolution to 300 DPI Bmp.SetResolution(300,300) 'Create a graphics object from the bitmap Using G = Graphics.FromImage(Bmp) 'Paint the canvas white G.Clear(Color.White) 'Set various modes to higher quality G.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic G.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias 'Create a font Using F As New Font("Arial",12) 'Create a brush Using B As New SolidBrush(Color.Black) 'Draw some text G.DrawString("Hello world",F,B,20,20) End Using End Using End Using 'Save the file as a TIFF Bmp.Save("c:\test.tiff",Imaging.ImageFormat.Tiff) End Using
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。