Impression/Aperçu avant impression d'une Picturebox
Bonjour à tous,
Je rencontre un problème j'espère que vous pouvez m'aider.
Je créer une picturebox grâce à ce code :
Code:
1 2 3 4 5 6 7 8 9 10 11
|
Private Sub NouveauToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NouveauToolStripMenuItem.Click
With CreateEtiq
.Location = New Drawing.Point(500, 250)
.Size = New Drawing.Size(699.212598425, 302.362204724)
.Visible = True
.BackColor = Color.WhiteSmoke
.BorderStyle = BorderStyle.FixedSingle
End With
Me.Controls.Add(CreateEtiq)
End Sub |
Ensuite je souhaite avoir un aperçu avant impression de ma picturebox puis l'imprimer :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim x As Integer = 500
Dim y As Integer = 250
Dim Width As Integer = 699.212598425
Dim Height As Integer = 302.362204724
Try
e.Graphics.DrawImage(CreateEtiq.Image, x, y, Width, Height)
Catch ex As Exception
End Try
End Sub
'Bouton impression'
Private Sub ToolStripButton_Print_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton_Print.Click
PrintDocument1.Print()
End Sub
'Aperçu avant impression de létiquette'
Private Sub ToolStripButton_PreviewPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton_PreviewPrint.Click
PrintPreviewDialog1.ShowDialog()
End Sub |
Mais malheureusement lorsque je clique sur aperçu avant impression j'obtiens une page blanche.. aucun signe de ma picturebox.
Je me doute que ça ne doit pas être la bonne méthode mais malgré plusieurs tentative je ne trouve pas la solution.
Une âme charitable peut-elle m'aider ?
Je vous remercie d'avance.