Bonjours j'ai créer un logiciel sur vb.net (Une caisse enregistreuse) il devrai imprimer trois tickets différent (Cuisine, boisson, pâtisserie) ce qui marche très bien mais les marges des deux dernier tickets sont déréglé je ne comprend pas j'ai utiliser exactement le même code pour les trois PrintDocuments à une exception près la Form qui accueil la RichTextBox ..
Voici le code :
Aidez moi svpCode:Private Sub PrintDocument1_PrintPage(sender As System.Object, e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage ComboBox1.DisplayMember = "PaperName" Dim printDoc As New PrintDocument Dim font1 As New Font("Microsoft Sans Serif", 14, FontStyle.Regular) e.Graphics.DrawString(Form3.RichTextBox1.Text, font1, Brushes.Black, 25, 10) ' ICI c'est les marges PrintDocument1.DefaultPageSettings.Margins.Left = ("0") PrintDocument1.DefaultPageSettings.Margins.Right = ("0") PrintDocument1.DefaultPageSettings.Margins.Top = ("0") Dim pkSize As PaperSize For i = 0 To printDoc.PrinterSettings.PaperSizes.Count - 1 pkSize = printDoc.PrinterSettings.PaperSizes.Item(i) ComboBox1.Items.Add(pkSize) Next Dim pkCustomSize1 As New PaperSize("Custom Paper Size", 30, 5) ComboBox1.Items.Add(pkCustomSize1) End Sub Private Sub LinkLabel4_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel4.LinkClicked MsgBox("Logiciel créer et inventer par AnonymousHD 13 ans sans l'aide d'internet ou autre." & vbCrLf & "Ce logiciel a pour but d'aider les personnes n'ayant pas les moyens d'avoir une caisse enregistreuse." & vbCrLf & "Minimum requis un ordinateur portable,un petit écran (moniteur), une impriente thermique papier 80X 80 X12" & vbCrLf & "Veuiller respecter les conditions d'utilisation Merci", MsgBoxStyle.Exclamation, "A propos !") End Sub Private Sub LinkLabel3_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel3.LinkClicked MsgBox("Télécharger : Microsoft Visual Basic Studio 2010 Express puis ouvrez le fichier Caisse Enregistreuse.sln", MsgBoxStyle.Exclamation, "Comment me modifier ?") End Sub Private Sub TextBox2_TextChanged(sender As System.Object, e As System.EventArgs) End Sub Private Sub PrintDocument2_PrintPage(sender As Object, e As PrintPageEventArgs) Handles PrintDocument2.PrintPage ComboBox2.DisplayMember = "PaperName" Dim printDoc As New PrintDocument Dim font1 As New Font("Microsoft Sans Serif", 14, FontStyle.Regular) e.Graphics.DrawString(Form3b.RichTextBox1.Text, font1, Brushes.Black, 25, 10) ' ICI c'est les marges PrintDocument1.DefaultPageSettings.Margins.Left = ("0") PrintDocument1.DefaultPageSettings.Margins.Right = ("0") PrintDocument1.DefaultPageSettings.Margins.Top = ("0") Dim pkSize As PaperSize For i = 0 To printDoc.PrinterSettings.PaperSizes.Count - 1 pkSize = printDoc.PrinterSettings.PaperSizes.Item(i) ComboBox1.Items.Add(pkSize) Next Dim pkCustomSize1 As New PaperSize("Custom Paper Size", 30, 5) ComboBox1.Items.Add(pkCustomSize1) End Sub Private Sub PrintDocument3_PrintPage(sender As Object, e As PrintPageEventArgs) Handles PrintDocument3.PrintPage ComboBox3.DisplayMember = "PaperName" Dim printDoc As New PrintDocument Dim font1 As New Font("Microsoft Sans Serif", 14, FontStyle.Regular) e.Graphics.DrawString(Form3c.RichTextBox1.Text, font1, Brushes.Black, 25, 10) ' ICI c'est les marges PrintDocument1.DefaultPageSettings.Margins.Left = ("0") PrintDocument1.DefaultPageSettings.Margins.Right = ("0") PrintDocument1.DefaultPageSettings.Margins.Top = ("0") Dim pkSize As PaperSize For i = 0 To printDoc.PrinterSettings.PaperSizes.Count - 1 pkSize = printDoc.PrinterSettings.PaperSizes.Item(i) ComboBox1.Items.Add(pkSize) Next Dim pkCustomSize1 As New PaperSize("Custom Paper Size", 30, 5) ComboBox1.Items.Add(pkCustomSize1) End Sub End Class
Merci de votre reponse
-----