Vb.Net应用程序从头开始创建一个位图,并转换为tiff或将其发送到打印机.在这两种情况下,图像的质量(在这种情况下是字体)都不是很好.下面列出的示例代码创建了我用来写入图像的图形对象.
Dim gr2 As Graphics = Graphics.FromImage(New Bitmap(800,1000),Imaging.PixelFormat.Format32bppPArgb))
除了@durilai说你可能想要提出解决方案,如果你打算打印. .Net使用的系统分辨率通常为96 DPI,但打印机可以使用300 DPI或更高的文件.
原文链接:https://www.f2er.com/vb/255031.html'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