在VB.Net中从头开始创建位图图像时,质量很糟糕吗?

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

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...