addamsmercredi
Messages postés121Date d'inscriptiondimanche 3 octobre 2004StatutMembreDernière intervention27 juillet 2006 27 juil. 2006 à 12:31
Voilà un petit code pour montrer comment imprimer plusieurs pages.
e.HasMorePages permet d'indiquer s'il y a d'autres pages à imprimer.
A chaque page, c'est la même fonction qui est exécutée, il faut donc utiliser des variables Static pour mémoriser où ça en est.
Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Static i as Integer = 1
e.Graphics.DrawString("C'est la page numéro " & i, ....)
i += 1
If (tout est imprimé) Then
e.HasMorePages = False
Else
e.HasMorePages = True
End If
cs_vara956
Messages postés50Date d'inscriptionmardi 12 octobre 2004StatutMembreDernière intervention 4 novembre 2008 27 juil. 2006 à 14:22
merci d'avoir répondu mais j'ai du mal a comprendre ce qui lui dits qui est dans la page 2, Comme c 'est moi qui lui dit a chaque ligne sa position celle ci ne s'incrémente pas seul bref comment lui faire comprendre que tel et tel ligne doivent etre sur la page 2
Puis je t'envoye le code de l'impression ? pour que tu vois ce que je veux dire
!!
Merci a toi encore
seb
voici le code complet de l'impression :
Private
Sub PrintDocument1_PrintPage(
ByVal sender
As System.Object,
ByVal e
As System.Drawing.Printing.PrintPageEventArgs)
Handles PrintDocument1.PrintPage
Dim drawFormat
As
New StringFormat
Dim blackPen
As
New Pen(Color.Black, 1)
Dim x
As
Single
Dim y
As
Single
Dim linesPerPage
As
Single = 0
Dim width
As
Single = 200.0F
Dim height
As
Single = 50.0F
Dim drawRect
As
New RectangleF(x, y, width, height)
Dim printfont
As
New Font("Arial", 13)
Dim printfontA
As
New Font("Arial", 16)
Dim printfontb
As
New Font("Arial", 8)
Dim printfont1
As
New Font("Arial", 18)
Dim printfont2
As
New Font("Arial", 20)
Dim Brush
As
New SolidBrush(Color.Black)
Try
'ligne
Dim x1
As
Single = 20.0F
Dim y1
As
Single = 60.0F
Dim x2
As
Single = 600.0F
Dim y2
AsSingle 60.0FlinesPerPage e.MarginBounds.Height / printfont.GetHeight(e.Graphics)
e.Graphics.DrawString("Offre de prix N° : " & numdevis.ToString.ToUpper, printfont, Brush, x, y + 160, drawFormat)
e.Graphics.DrawString("Rueil, le " &
Date.Now.Today.ToLongDateString, printfont, Brush, x + 450, y + 180, drawFormat)e.Graphics.DrawString("Madame, Monsieur,", printfont, Brush, x, y + 220, drawFormat)
e.Graphics.DrawString("En réponse à votre demande pour l'affaire citée en objet, nous vous prions de bien vouloir " & vbCrLf & " trouver ci-joint notre meilleur offre de prix pour la founiture de matériel Basse Tension au" & vbCrLf & "prix Net total H.T de : ", printfont, Brush, x, y + 260, drawFormat)
'e.Graphics.DrawString("vouloir trouver ci-joint notre meilleur offre de prix pour la founiture de matériel Basse" & vbCrLf & "Tension au prix Net total H.T de : ", printfont, Brush, x, y + 260)e.Graphics.DrawString("Cette proposition s'entend avec les conditions suivantes : ", printfont, Brush, x, y + 350, drawFormat)
e.Graphics.DrawString("- Condition de livraison" & vbTab & ": Port à facturer", printfont, Brush, 40, y + 370, drawFormat)
e.Graphics.DrawString("- Délai de livraison" & vbTab & ": Voir Page matériel", printfont, Brush, 40, y + 390, drawFormat)
If etude =
True
Thene.Graphics.DrawString("- Condition de paiement" & vbTab & ": Par distributeur", printfont, Brush, 40, y + 410, drawFormat)
Elsee.Graphics.DrawString("- Condition de paiement" & vbTab & ": 60 jours", printfont, Brush, 40, y + 410, drawFormat)
End
Ife.Graphics.DrawString("- Validité de l'offre" & vbTab & ": " & valide.ToString.ToUpper, printfont, Brush, 40, y + 430, drawFormat)
e.Graphics.DrawString("La présente offre est soumise au condition générales de vente en vigueur dans la société" & vbCrLf & "ABB Entrelec, conditions disponibles, dans nos catalogues ou sur simple demande auprès" & vbCrLf & "de votre interlocuteur commercial.", printfont, Brush, 20, y + 470, drawFormat)
e.Graphics.DrawString("Espérant avoir répondu à votre demande et restant à votre entière disposition pour tous" & vbCrLf & "renseignements complémentaire nécessaires à vous-même ou vos services nous vous" & vbCrLf & "prions de croire Madame, Monsieur en l'expression de nos sincères salutations.", printfont, Brush, 20, y + 550, drawFormat)
If Len(infoclient.ToString) <> 0
Thene.Graphics.DrawString("****************************************** ATTENTION ******************************************", printfont, Brush, 20, y + 670, drawFormat)
e.Graphics.DrawString(infoclient.ToString.ToUpper, printfont, Brush, 40, y + 710, drawFormat)
End
Ife.Graphics.DrawString("Solufast version ABB V1.00", printfontb, Brush, 360, 1100, drawFormat)
'mettre c info sur la page page(2)e.Graphics.DrawString("Nom de l'affaire: " & Affairedevis.ToString, printfontA, Brush, x, y + 1500, drawFormat)