Seitengröße für Druck anpassen

  • VB.NET

Es gibt 1 Antwort in diesem Thema. Der letzte Beitrag () ist von RodFromGermany.

    Seitengröße für Druck anpassen

    Hallo zusammen,

    ich sitze seit über einer Woche an meinem "Tool" und verzweifle langsam.
    Erklärung:

    Ich bin Zeitungszusteller (nebensächlich) und habe für diese Tätigkeit ein Tourenbuch mit so genannten "Einlegern" (Siehe Foto "Einleger lang 50%.jpg).
    Jetzt möchte ich diese Einlagen bedrucken können, das hat von den Datensätzen usw ja auch geklappt, es kommt auf DinA4 aus meinem Drucker raus,
    ABER
    wenn ich jetzt einen "Einleger" in den Drucker lege, dann kommt nichts dabei raus, weil er mir das auf die Walze druckt.

    Die Seitengröße ist: 9,7 cm Breit und 20,8 cm Hoch, also auch keine Din größe.

    VB.NET-Quellcode

    1. Imports System.Drawing.Printing
    2. Public Class Form2
    3. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    4. 'Drucken
    5. Drucken_Vorschau()
    6. Dim standard_drucker As New PrintDocument
    7. PrintDocument1.PrinterSettings.PrinterName = standard_drucker.PrinterSettings.PrinterName
    8. PrintDocument1.Print()
    9. End Sub
    10. Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As PrintPageEventArgs) Handles PrintDocument1.PrintPage
    11. Dim Hintergrundbild As System.Drawing.Image
    12. ' Hintergrundbild = Image.FromFile("C:\Users\TerrorPC\Pictures\ControlCenter3\Scan\Einleger lang.jpg")
    13. 'e.Graphics.DrawImage(Hintergrundbild, 0, 0)
    14. e.Graphics.DrawString(Straßenname.Text, New Font("Arial", 24), Brushes.Black, 200, 2)
    15. 'Hausnummern
    16. e.Graphics.DrawString(AdresseTextBox1.Text, New Font("Arial", 24), Brushes.Black, 100, 100)
    17. e.Graphics.DrawString(AdresseTextBox2.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    18. e.Graphics.DrawString(AdresseTextBox3.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    19. e.Graphics.DrawString(AdresseTextBox4.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    20. e.Graphics.DrawString(AdresseTextBox5.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    21. e.Graphics.DrawString(AdresseTextBox6.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    22. e.Graphics.DrawString(AdresseTextBox7.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    23. e.Graphics.DrawString(AdresseTextBox8.Text, New Font("Arial", 24), Brushes.Black, 10, 30)
    24. e.Graphics.DrawString(AdresseTextBox9.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    25. e.Graphics.DrawString(AdresseTextBox10.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    26. e.Graphics.DrawString(AdresseTextBox11.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    27. e.Graphics.DrawString(AdresseTextBox12.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    28. e.Graphics.DrawString(AdresseTextBox13.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    29. e.Graphics.DrawString(AdresseTextBox14.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    30. e.Graphics.DrawString(AdresseTextBox15.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    31. e.Graphics.DrawString(AdresseTextBox16.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    32. e.Graphics.DrawString(AdresseTextBox17.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    33. e.Graphics.DrawString(AdresseTextBox18.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    34. 'Name
    35. e.Graphics.DrawString(NameTextBox1.Text, New Font("Arial", 24), Brushes.Black, 10, 30)
    36. e.Graphics.DrawString(NameTextBox2.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    37. e.Graphics.DrawString(NameTextBox3.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    38. e.Graphics.DrawString(NameTextBox4.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    39. e.Graphics.DrawString(NameTextBox5.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    40. e.Graphics.DrawString(NameTextBox6.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    41. e.Graphics.DrawString(NameTextBox7.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    42. e.Graphics.DrawString(NameTextBox8.Text, New Font("Arial", 24), Brushes.Black, 10, 30)
    43. e.Graphics.DrawString(NameTextBox9.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    44. e.Graphics.DrawString(NameTextBox10.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    45. e.Graphics.DrawString(NameTextBox11.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    46. e.Graphics.DrawString(NameTextBox12.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    47. e.Graphics.DrawString(NameTextBox13.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    48. e.Graphics.DrawString(NameTextBox14.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    49. e.Graphics.DrawString(NameTextBox15.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    50. e.Graphics.DrawString(NameTextBox16.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    51. e.Graphics.DrawString(NameTextBox17.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    52. e.Graphics.DrawString(NameTextBox18.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    53. 'Täglich
    54. e.Graphics.DrawString(Ausgabetäglich1.Text, New Font("Arial", 24), Brushes.Black, 10, 30)
    55. e.Graphics.DrawString(Ausgabetäglich2.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    56. e.Graphics.DrawString(Ausgabetäglich3.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    57. e.Graphics.DrawString(Ausgabetäglich4.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    58. e.Graphics.DrawString(Ausgabetäglich5.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    59. e.Graphics.DrawString(Ausgabetäglich6.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    60. 'Unbearbeitet---------------------------------------------------------------------------------------------------
    61. e.Graphics.DrawString(AdresseTextBox7.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    62. e.Graphics.DrawString(AdresseTextBox8.Text, New Font("Arial", 24), Brushes.Black, 10, 30)
    63. e.Graphics.DrawString(AdresseTextBox9.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    64. e.Graphics.DrawString(AdresseTextBox10.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    65. e.Graphics.DrawString(AdresseTextBox11.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    66. e.Graphics.DrawString(AdresseTextBox12.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    67. e.Graphics.DrawString(AdresseTextBox13.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    68. e.Graphics.DrawString(AdresseTextBox14.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    69. e.Graphics.DrawString(AdresseTextBox15.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    70. e.Graphics.DrawString(AdresseTextBox16.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    71. e.Graphics.DrawString(AdresseTextBox17.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    72. e.Graphics.DrawString(AdresseTextBox18.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    73. 'Wochenende
    74. e.Graphics.DrawString(AusgabeWE1.Text, New Font("Arial", 24), Brushes.Black, 10, 30)
    75. e.Graphics.DrawString(AusgabeWE2.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    76. e.Graphics.DrawString(AusgabeWE3.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    77. e.Graphics.DrawString(AusgabeWE4.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    78. e.Graphics.DrawString(AusgabeWE5.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    79. e.Graphics.DrawString(AusgabeWE6.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    80. 'Unbearbeitet---------------------------------------------------------------------------------------------------
    81. e.Graphics.DrawString(AdresseTextBox7.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    82. e.Graphics.DrawString(AdresseTextBox8.Text, New Font("Arial", 24), Brushes.Black, 10, 30)
    83. e.Graphics.DrawString(AdresseTextBox9.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    84. e.Graphics.DrawString(AdresseTextBox10.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    85. e.Graphics.DrawString(AdresseTextBox11.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    86. e.Graphics.DrawString(AdresseTextBox12.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    87. e.Graphics.DrawString(AdresseTextBox13.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    88. e.Graphics.DrawString(AdresseTextBox14.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    89. e.Graphics.DrawString(AdresseTextBox15.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    90. e.Graphics.DrawString(AdresseTextBox16.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    91. e.Graphics.DrawString(AdresseTextBox17.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    92. e.Graphics.DrawString(AdresseTextBox18.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    93. 'Samstag
    94. e.Graphics.DrawString(AusgabeSA1.Text, New Font("Arial", 24), Brushes.Black, 10, 30)
    95. e.Graphics.DrawString(AusgabeSA2.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    96. e.Graphics.DrawString(AusgabeSA3.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    97. e.Graphics.DrawString(AusgabeSA4.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    98. e.Graphics.DrawString(AusgabeSA5.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    99. e.Graphics.DrawString(AusgabeSA6.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    100. 'Unbearbeitet---------------------------------------------------------------------------------------------------
    101. e.Graphics.DrawString(AdresseTextBox7.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    102. e.Graphics.DrawString(AdresseTextBox8.Text, New Font("Arial", 24), Brushes.Black, 10, 30)
    103. e.Graphics.DrawString(AdresseTextBox9.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    104. e.Graphics.DrawString(AdresseTextBox10.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    105. e.Graphics.DrawString(AdresseTextBox11.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    106. e.Graphics.DrawString(AdresseTextBox12.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    107. e.Graphics.DrawString(AdresseTextBox13.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    108. e.Graphics.DrawString(AdresseTextBox14.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    109. e.Graphics.DrawString(AdresseTextBox15.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    110. e.Graphics.DrawString(AdresseTextBox16.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    111. e.Graphics.DrawString(AdresseTextBox17.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    112. e.Graphics.DrawString(AdresseTextBox18.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    113. 'Ablageplatz
    114. e.Graphics.DrawString(Ablageort1.Text, New Font("Arial", 24), Brushes.Black, 10, 30)
    115. e.Graphics.DrawString(Ablageort2.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    116. e.Graphics.DrawString(Ablageort3.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    117. e.Graphics.DrawString(Ablageort4.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    118. e.Graphics.DrawString(Ablageort5.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    119. e.Graphics.DrawString(Ablageort6.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    120. 'Unbearbeitet---------------------------------------------------------------------------------------------------
    121. e.Graphics.DrawString(AdresseTextBox7.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    122. e.Graphics.DrawString(AdresseTextBox8.Text, New Font("Arial", 24), Brushes.Black, 10, 30)
    123. e.Graphics.DrawString(AdresseTextBox9.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    124. e.Graphics.DrawString(AdresseTextBox10.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    125. e.Graphics.DrawString(AdresseTextBox11.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    126. e.Graphics.DrawString(AdresseTextBox12.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    127. e.Graphics.DrawString(AdresseTextBox13.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    128. e.Graphics.DrawString(AdresseTextBox14.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    129. e.Graphics.DrawString(AdresseTextBox15.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    130. e.Graphics.DrawString(AdresseTextBox16.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    131. e.Graphics.DrawString(AdresseTextBox17.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    132. e.Graphics.DrawString(AdresseTextBox18.Text, New Font("Arial", 24), Brushes.Black, 10, 10)
    133. End Sub
    134. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    135. Drucken_Vorschau()
    136. End Sub
    137. Function Drucken_Vorschau()
    138. PrintDocument1.PrinterSettings.PrinterName = "Brother DCP-9040CN Printer"
    139. PrintPreviewDialog1.Document = PrintDocument1
    140. PrintPreviewControl1.Document = PrintPreviewDialog1.Document
    141. PrintPreviewControl1.AutoZoom = True
    142. End Function
    143. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    144. Me.Close()
    145. Form1.Show()
    146. End Sub
    147. End Class


    So sieht aktuell meine Form2 aus.

    In den Bereichen "Unbearbeitet" muss ich die Textbox noch den richtigen Namen zuordnen

    wäre super wenn mir einer einen Tip geben könnte, bin nämlich Neuling und das ist erst mein zweites "Projekt"

    Danke schon mal im Vorraus

    "Visual Basic 2010 Express"
    Bilder
    • Einleger lang 50%.jpg

      57,59 kB, 295×624, 87 mal angesehen
    @HerrvomSee Willkommen im Forum. :thumbup:
    Du kannst im Print-Dialog die Papiergröße und den Druckbereich vorgeben.
    Drucke eine Tabelle, nicht aber jede Zeile einzeln.
    Arbeite mal exemplarisch diesen Thread durch, nimm einen PDF-Drucker, da brauchst Du kein Papier. Drucken mehrseitiger Dokumente
    Falls Du diesen Code kopierst, achte auf die C&P-Bremse.
    Jede einzelne Zeile Deines Programms, die Du nicht explizit getestet hast, ist falsch :!:
    Ein guter .NET-Snippetkonverter (der ist verfügbar).
    Programmierfragen über PN / Konversation werden ignoriert!