I have a scroll-able form which I would like to print entirely.
I have already tried using this code to print it:
Private Sub btnPrint_Click(ByVa
I had a similar problem I was able to solve without any additional libraries or extensions. It is simple with the DrawToBitmap method available on most Forms controls.
Dim ctrlColl As ControlCollection
Dim i As Integer = 0
' Get collection of controls
ctrlColl = Me.Controls
' create bitmap array
Dim Bitmaps(ctrlColl.Count - 1) As Bitmap
' remove controls you have hidden before printing
For Each ctrl As Control In ctrlColl
If Not ctrl.Visible Then
ctrlColl.Remove(ctrl)
End If
Next
' Loop through controls
For Each ctrl As Control In ctrlColl
' create bitmap from control.DrawToBitmap
Bitmaps(i) = New Bitmap(ctrl.Width, ctrl.Height)
ctrl.DrawToBitmap(Bitmaps(i), ctrl.ClientRectangle)
i = i + 1
Next
' Print each bitmap in array
i = 0
For Each bmp As Bitmap In Bitmaps
e.Graphics.DrawImage(bmp, New Point(ctrlColl(i).Location.X, ctrlColl(i).Location.Y))
i = i + 1
Next
End Sub