1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
Imports System.Drawing.Printing
Public Class Form2
Dim pd As New PrintDocument
Dim StandardPrintController As New StandardPrintController 'pour ne pas afficher page 1/x a l'impression
Private Sub Form2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
pd.PrintController = StandardPrintController 'pour ne pas afficher page 1/x a l'impression
AddHandler pd.PrintPage, AddressOf Me.Pd_PrintPage
End Sub
Private Sub Pd_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs)
e.Graphics.DrawString("TEST", New Font("Arial", 12, FontStyle.Bold), Brushes.Black, 1, 1)
e.HasMorePages = True
e.Graphics.DrawString("TEST", New Font("Arial", 12, FontStyle.Bold), Brushes.Black, 1, 1)
e.HasMorePages = False
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim dllg As New PrintPreviewDialog
dllg.Document = pd
dllg.ShowDialog()
End Sub
End Class |
Partager