title: printing scrollable panel with image inside in vb
body: <p>Good Day everyone. i have a problem in printing the  image in my scrollable panel. can anyone help me with this?</p>
  
  <p>i wanted to resize the images first (so it can fit the 8.5 by 11" paper) before showing it in print preview then printing it </p>
  
  <p>in my case, i have a form(form1) with a panel (dock=fill) and i wanted to print the images (2 images) inside it. but, the trigger of the printing of image is in the next form</p>
  
  <p>in btnnext(form1)
       Form2.Show()
       Me.Hide()</p>
  
  <p>and the printing code is in the form2. i am new in vb and i don't have any idea about printing the scrollable panel. i tried different codes in other forums but it didn't print the whole image but only the screenshot of the form. any response will be appreciated., thank you so much</p>
  
  <hr>
  
  <pre><code>Public Class Form2
  
  Private WithEvents pd As New Printing.PrintDocument
  Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
      Using bmp As New Bitmap(Form1.pb1.Width, Form1.pb1.Height)
          Form1.panel1.DrawToBitmap(bmp, New Rectangle(0, 0, Form1.pb1.Width, Form1.pb1.Height))
          e.Graphics.DrawImage(bmp, e.MarginBounds)
      End Using
  End Sub
  Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
      PrintDocument1.Print()
  End Sub 
  End Class
  </code></pre>
  
  <p>-
  ^it only prints what you can see in the screen. not the whole panel..</p>