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 29 30 31 32 33 34 35 36 37 38 39 40
| Private Sub BtnImprimer_Click(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles BtnImprimer.Click
Dim Police As New Font("Arial", 11)
Dim PoliceGras As New Font("Arial", 12, FontStyle.Bold)
Dim XPos, YPos As Single
Dim ChaineImpr As String
Dim MiseEnPage As New PageSetupDialog
Dim MonDoc As New Printing.PrintDocument
With MiseEnPage
.Document = MonDoc
.AllowOrientation = False
.AllowPaper = False
.EnableMetric = True
.MinMargins = New Printing.Margins(100, 100, 50, 50)
.ShowDialog(Me)
.Dispose()
End With
Using MyGraphics As Graphics = e.Graphics
Dim Picture As New Bitmap(Me.PictureBox1.Image)
MyGraphics.DrawImage(Picture, 2.0F * e.MarginBounds.Width / 3.0F, YPos)
Dim SautLigne As Single = MyGraphics.MeasureString("X", PoliceGras).Height
ChaineImpr = Me.TXTCIN.Text + " -- " + Me.TXTCNRPS.Text + " -- " + Me.TXTMutuel.Text
MyGraphics.DrawString(ChaineImpr, PoliceGras, Brushes.Black, XPos, YPos)
YPos = YPos + SautLigne * 1.5F
ChaineImpr = "Prenom : " + Me.TXTPreNomPers.Text
MyGraphics.DrawString(ChaineImpr, Police, Brushes.Black, XPos, YPos)
YPos = YPos + SautLigne * 1.5F
ChaineImpr = "Date de Recruttement : " + Me.TXTDateRecrutement.Text
MyGraphics.DrawString(ChaineImpr, Police, Brushes.Black, XPos, YPos)
YPos = YPos + SautLigne * 3.0F
End Using
End Sub |
Partager