Accueil > Forum > > > > impression sur vb.net
impression sur vb.net
jeudi 27 juillet 2006 à 10:13:18 |
impression sur vb.net

vara956
|
Salut, je sais maitriser le composant printdocument dans mon apli, faire un apercu, imprimer mais je pige pas comment fait on pour faire une deuxieme page ? voici un morceaux de mon code 'icone(logo)e.Graphics.DrawString("ABB Entrelec", printfontA, Brush, 20, 35) e.Graphics.DrawLine(blackPen, x1, y1, x2, y2) e.Graphics.DrawString("Siège social :" & vbTab & "10 rue ampère", printfontb, Brush, 100, 60) e.Graphics.DrawString(vbTab & vbTab & "ZI - BP 114", printfontb, Brush, 100, 75) e.Graphics.DrawString(vbTab & vbTab & "69685 Chassieu cédex", printfontb, Brush, 100, 90) e.Graphics.DrawImage(newImage.FromFile("C:\solufast\data\ABB_logo.gif"), 630.0F, 30.0F) 'destinatairex = 20 y = 170 e.Graphics.DrawString("Télécopie", printfont1, Brush, x, y - 50) e.Graphics.DrawString("De / From : " & usernom.ToString.ToUpper, printfont, Brush, x, y - 20) e.Graphics.DrawString("Comercial : " & sel_iv.ToString.ToUpper, printfont, Brush, x, y + 20) e.Graphics.DrawString("Tél.: " & usertel.ToString, printfont, Brush, x + 550, y - 20) e.Graphics.DrawString("Fax.: " & userfax.ToString, printfont, Brush, x + 550, y) e.Graphics.DrawString("Gsm.: " & sel_faxliv.ToString, printfont, Brush, x + 550, y + 20) e.Graphics.DrawString("A / To: Société: " & sel_client.ToString.ToUpper, printfont, Brush, x, y + 60) e.Graphics.DrawString(" Nom: " & sel_interloc.ToString.ToUpper, printfont, Brush, x, y + 80) e.Graphics.DrawString("Tel.: " & sel_telint.ToString, printfont, Brush, x + 550, y + 100) e.Graphics.DrawString("Fax.: " & sel_faxint.ToString, printfont, Brush, x + 550, y + 120)
bref ya d'autere ligne pour remplir la premier feuille mais je voudrai mettre des info sur le deuxieme page !! et la je bloque
c super important merci de votre aide
|
|
jeudi 27 juillet 2006 à 12:31:26 |
Re : impression sur vb.net

addamsmercredi
|
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 End Sub
|
|
jeudi 27 juillet 2006 à 14:22:07 |
Re : impression sur vb.net

vara956
|
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 : PrivateSub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage Dim drawFormat AsNew StringFormatDim blackPen AsNew Pen(Color.Black, 1)Dim x AsSingleDim y AsSingleDim linesPerPage AsSingle = 0Dim width AsSingle = 200.0FDim height AsSingle = 50.0FDim drawRect AsNew RectangleF(x, y, width, height)Dim printfont AsNew Font("Arial", 13)Dim printfontA AsNew Font("Arial", 16)Dim printfontb AsNew Font("Arial", 8)Dim printfont1 AsNew Font("Arial", 18)Dim printfont2 AsNew Font("Arial", 20)Dim Brush AsNew SolidBrush(Color.Black) Try'ligneDim x1 AsSingle = 20.0FDim y1 AsSingle = 60.0FDim x2 AsSingle = 600.0FDim y2 AsSingle = 60.0FlinesPerPage = e.MarginBounds.Height / printfont.GetHeight(e.Graphics) 'icone(logo)e.Graphics.DrawString("ABB Entrelec", printfontA, Brush, 20, 35, drawFormat) e.Graphics.DrawLine(blackPen, x1, y1, x2, y2) e.Graphics.DrawString("Siège social :" & vbTab & "10 rue ampère", printfontb, Brush, 100, 60, drawFormat) e.Graphics.DrawString(vbTab & vbTab & "ZI - BP 114", printfontb, Brush, 100, 75, drawFormat) e.Graphics.DrawString(vbTab & vbTab & "69685 Chassieu cédex", printfontb, Brush, 100, 90, drawFormat) e.Graphics.DrawImage(newImage.FromFile("C:\solufast\data\ABB_logo.gif"), 630.0F, 30.0F) 'destinatairex = 20 y = 170 e.Graphics.DrawString("Télécopie", printfont1, Brush, x, y - 50, drawFormat) e.Graphics.DrawString("De / From : " & usernom.ToString.ToUpper, printfont, Brush, x, y - 20, drawFormat) e.Graphics.DrawString("Comercial : " & sel_iv.ToString.ToUpper, printfont, Brush, x, y + 20, drawFormat) e.Graphics.DrawString("Tél.: " & usertel.ToString, printfont, Brush, x + 550, y - 20, drawFormat) e.Graphics.DrawString("Fax.: " & userfax.ToString, printfont, Brush, x + 550, y, drawFormat) e.Graphics.DrawString("Gsm.: " & sel_faxliv.ToString, printfont, Brush, x + 550, y + 20, drawFormat) e.Graphics.DrawString("A / To: Société: " & sel_client.ToString.ToUpper, printfont, Brush, x, y + 60, drawFormat) e.Graphics.DrawString(" Nom: " & sel_interloc.ToString.ToUpper, printfont, Brush, x, y + 80, drawFormat) e.Graphics.DrawString("Tel.: " & sel_telint.ToString, printfont, Brush, x + 550, y + 60, drawFormat) e.Graphics.DrawString("Fax.: " & sel_faxint.ToString, printfont, Brush, x + 550, y + 80, drawFormat) 'info devise.Graphics.DrawString("V/Réf.: " & Affairedevis.ToString, printfont, Brush, x, y + 140, drawFormat) 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 = TrueThene.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) EndIfe.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) EndIfe.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) e.Graphics.DrawString("N° offre: " & numdevis.ToString.ToUpper, printfontb, Brush, x, y + 1520, drawFormat) e.Graphics.DrawString("Date du chiffrage: " & Date.Now.Today.ToLongDateString, printfontb, Brush, x, y + 1540, drawFormat)e.Graphics.DrawString("Nom du demandeur: " & sel_interloc.ToString.ToUpper, printfontb, Brush, x, y + 1560, drawFormat) e.Graphics.DrawString("Nom de la société: " & sel_client.ToString.ToUpper, printfontb, Brush, x, y + 1580, drawFormat) If etude = TrueThene.Graphics.DrawString("Type de chiffrage: Etude de prix", printfontb, Brush, x + 500, y + 1520, drawFormat) Elsee.Graphics.DrawString("Type de chiffrage: Offre de prix", printfontb, Brush, x + 500, y + 1520, drawFormat) EndIfe.Graphics.DrawString("Liste du matériel", printfont2, Brush, x + 350, y + 1550, drawFormat) 'e.Graphics.DrawLine(blackPen, x1, y1, x2, y2)e.Graphics.DrawString("Référence" & usernom.ToString.ToUpper, printfontb, Brush, x, y + 1620, drawFormat) e.Graphics.DrawString("Désignation" & sel_iv.ToString.ToUpper, printfontb, Brush, x + 50, y + 1620, drawFormat) e.Graphics.DrawString("Qts." & usertel.ToString, printfontb, Brush, x + 150, y + 1620, drawFormat) e.Graphics.DrawString("Col." & sel_faxint.ToString, printfontb, Brush, x + 200, y + 1620, drawFormat) e.Graphics.DrawString("Prix Net" & userfax.ToString, printfontb, Brush, x + 250, y + 1620, drawFormat) e.Graphics.DrawString("Délai" & sel_faxliv.ToString, printfontb, Brush, x + 300, y + 1620, drawFormat) e.Graphics.DrawString("Info" & sel_telint.ToString, printfontb, Brush, x + 350, y + 1620, drawFormat) y1 = y1 + 200 y2 = y2 + 1620 'e.Graphics.DrawLine(blackPen, x1, y1, x2, y2)e.HasMorePages = True Catch ex As ExceptionMsgBox(ex.Message, MsgBoxStyle.Critical) EndTry
|
|
jeudi 27 juillet 2006 à 14:23:51 |
Re : impression sur vb.net

vara956
|
PS : la partie avant le ' a mettre sur la page 2 fonctionne tres bien sur une page ,
|
|
jeudi 27 juillet 2006 à 14:41:25 |
Re : impression sur vb.net

addamsmercredi
|
Réponse acceptée !
Si il y a toujours 2 pages, tu peux faire comme ceci. J'espère que ça te sera plus clair. Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage Static Premiere as Boolean = True If Premiere then 'Ici c'est la première page Premiere = False e.HasMorePages = True Else 'Ici c'est la deuxième page Premiere = True e.HasMorePages = False End if End Sub
|
|
jeudi 27 juillet 2006 à 15:51:49 |
Re : impression sur vb.net

vara956
|
encore merci a toi ca marche je devrai y comprendre meiux
|
|
Cette discussion est classée dans : graphics, drawstring, tostring, brush, printfont
Répondre à ce message
Sujets en rapport avec ce message
l'impression avec e.graphic.... [ par vara956 ]
salutvoila je fais une application pour faire des devis,tout fonctionne correctement meme l'impression,mais je voudrait mettre certaine lignes en gras
Boucle For dans boucle While pour impression sur plusieurs pages ??!! [ par gnes ]
Salut, j'ai un gros souci avec mon application !!!!!!!!! Je fais une impression d'une liste, et ma liste est très longue, Pour mon impression, il ne m
Problème en VB.Net et DrawString (erreur générique GDI+) [ par azerty25 ]
Bonjour J'ai le code suivant, pour écrire du texte sur un nouveau formulaire et la fonction drawstring me renvoye une erreur générique GDI+ si showint
Utilisation de la classe graphics et drawstring [ par frk22 ]
Bonjour a tous !!!Je développe sous vb2008 studio et mon souci est le suivant : j utilise une forme dans laquelle je place du texte par la classe "g
Imprimé sur du papier continu [ par supermatcho ]
Bonjours, je doit imprimer sur du papier thermal en alimentation continu de papier.voici ma partie du code,PrivateSub</font
Changer couleur drawstring [ par angelblood ]
Salut a tous, Je vous explique : J'ai des drawstring avec une couleur et je voudrais que lorsque que la souris arrive dans la zone elle change de coul
problème pour imprimer [ par baltazar85 ]
Bonjour,alors voila j'ai fais une classe d'impression en vb.net mais le problème c'est que je n'arrive pas a envoyer de donnée a ma classe.Les données
problème d'impression class [ par baltazar85 ]
Bonjour,alors voila j'ai fais une classe d'impression en vb.net mais le problème c'est que je n'arrive pas a envoyer de donnée a ma classe.Les données
problème d'impression multi page [ par joujma5 ]
bonjour, j'ai procédé par le drawing pour imprimer un état, mais je retrouve un problème lorsque l'impression s'étale sur plus qu'une page, je ne sait
Nouvelle classe Image_Class : traitement trop long... [ par fsintegral ]
Bonjour ! Tout d'abord, Bonne Année à tous ! Puis, la situation : 1) Je suis débutant : je ne sais utiliser que [b]Graphics[/b]. 2) Je suis en train
Livres en rapport
|
Derniers Blogs
XNA IS DEAD!XNA IS DEAD! par richardc
Depuis la semaine dernière (et grâce aux TechDays 2012), je me penche activement sur la nouvelle version de Windows, aka Windows 8. Vous me direz, il était temps puisque la première preview date de Septembre dernier.
OK. Remarquez, on n'en est qu'aux...
Cliquez pour lire la suite de l'article par richardc TECHDAYS PARIS 2012 : WINDOWS SERVER "8" QUOI DE 9 !TECHDAYS PARIS 2012 : WINDOWS SERVER "8" QUOI DE 9 ! par ROMELARD Fabrice
Speakers: Fabrice Meillon et Stanislas Quastana Cette session est basée entièrement sur celle donnée lors de la BUILD cet hiver. Il n'y a pas d'ajout d'information en rapport avec cet évènement passé. Windows 8 Server sera intégralem...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice [HTML5] AUTOUR DU W3C : NOUVEAUX STANDARDS ET WEB MOBILE (LILLE)[HTML5] AUTOUR DU W3C : NOUVEAUX STANDARDS ET WEB MOBILE (LILLE) par Gio
Je m'y prends un peu tard je sais, mais bon je suis développeur web et donc hyper fainéant ! Toujours dans le cadre des technologies émergentes, ici HTML5, parce qu'on aime HTML5 chez Wyg , nous seront présent, le vieux ( Aurélien V.) et moi, pour pr...
Cliquez pour lire la suite de l'article par Gio [WP7] DYNAMICALLY CHANGE STARTUP PAGE[WP7] DYNAMICALLY CHANGE STARTUP PAGE par KooKiz
Let's say that you want to allow the user to customize the startup page of your application. You can easily change the startup page by editing the 'NavigationPage' attribute in the manifest file. But the manifest cannot be modified once the applicatio...
Cliquez pour lire la suite de l'article par KooKiz
Logiciels
DocTranslate (V3.1.0.0)DOCTRANSLATE (V3.1.0.0)DocTranslate est un traducteur de document Microsoft Word, PowerPoint et Excel. Il permet d'autom... Cliquez pour télécharger DocTranslate Tribler (2012)TRIBLER (2012)Tribler est un client pair à pair (P2P/Peer-to-Peer) open source avec la capacité de regarder des... Cliquez pour télécharger Tribler OneSwarm (2012)ONESWARM (2012)Le peer-to-peer qui protège votre vie privée, c'est OneSwarm.
Ce logiciel de peer-to-peer crypté... Cliquez pour télécharger OneSwarm PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System
|