How to avoid fuzzy printing after a screen capture?
I'm using the code below to capture and print a windows form. The problem is that it prints out very fuzzy. Is there any way to have it print more clearly?
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
Chances are, your printing settings (or limited capabilities) might be the culprit.
You can try changing your bitmap resolution to see if it improves the output.
bmp1.SetResolution(dpX, dpY)
Printing my own form using your code, I get acceptable output.
Or maybe our definitions of "very fuzzy" are very different. :-)
精彩评论