Hello

I think this is a easy to fix problem, but I have no idea how. I'm using PrintDocument and want to print an image which should be in center of the printed page. How do I code this? This is what I got so far:

VB Code:
  1. Private Sub Print()
  2.         Dim pd As New Printing.PrintDocument()
  3.  
  4.         AddHandler pd.PrintPage, AddressOf PrintPage
  5.         'Start printing.
  6.         pd.Print()
  7.     End Sub
  8.  
  9.     Private Sub PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)
  10.         e.PageSettings.Margins.Left = 0
  11.         e.PageSettings.Margins.Right = 0
  12.         e.PageSettings.Margins.Top = 0
  13.         e.PageSettings.Margins.Bottom = 0
  14.  
  15.         'Draw the image on the printing surface.
  16.         Try
  17.             e.Graphics.DrawImage(capWin, 0, 0, 0, 0)
  18.         Catch ex As Exception
  19.             MessageBox.Show("Some message", "Printer Notification Message", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly, False)
  20.         End Try
  21.  
  22.     End Sub