屏幕截图后如何避免模糊打印?

时间:2011-06-21 19:39:42

标签: vb.net printing gdi+

我正在使用下面的代码来捕获和打印Windows窗体。问题是它打印出非常模糊。有没有办法让它打印得更清楚?

Imports System.Drawing.Printing
Public bmp1 As Bitmap
Private WithEvents printDocument1 As New PrintDocument

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim L, T, W, H As Integer
    L = form1.Left : T = form1.Top : W = form1.Width : H = form1.Height

    Dim Bmp0 As New Bitmap(W, H)
    Dim g0 As Graphics = Graphics.FromImage(Bmp0)

    g0.CopyFromScreen(L, T, 0, 0, New Size(W, H))
    g0.Dispose()
    bmp1 = New Bitmap(Bmp0, 750, 562)

    printDocument1.Print()
End Sub

Private Sub printDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles printDocument1.PrintPage
    e.Graphics.DrawImage(bmp1, 0, 0)
End Sub

1 个答案:

答案 0 :(得分:1)

有可能,您的打印设置(或有限的功能)可能是罪魁祸首。

您可以尝试更改位图分辨率以查看它是否可以改善输出。

bmp1.SetResolution(dpX, dpY)

使用您的代码打印我自己的表单,我得到可接受的输出。

或许我们对“非常模糊”的定义非常不同。 : - )