Neuer Versuch eure Gunst zu gewinnen
so passt es in den angelegten Druckbereich:
ich drucke mehr Seiten aber nicht wirklich, d.h. so erhöhe ich nur die Seitenanzahl ist ja nicht im Sinne des Erfinders möchte ja korrekt etwas auf die neue Seite drucken was eben auf Seite eins nicht passt.
hier die Druckroutine
wer hilft mir da noch mal ?
Private Sub PD_Strombeleg_PrintPage(ByVal sender As Object, ByVal e As _
PrintPageEventArgs) Handles PD_Strombeleg.PrintPage
Dim g As Graphics = e.Graphics
DruckSeite += 1
Hier fehlt einiges aufgrund der erlaubten 5KB Text größe
'Titel & Druckdatum & Seite
'Daten holen aus Datatable
For i As Integer = 0 To HBDatenbankDS.tblStrom.Rows.Count - 1
Dim row As DataRow = HBDatenbankDS.tblStrom.Rows(i)
Dim bildpfad As String = row("Pfad").ToString
' Größe für ein Bild
Dim imageBounds As New Size(e.MarginBounds.Width \ 4, _
e.MarginBounds.Height \ 7)
'mit imageBounds so bekomme ich 5 Bilder (Belege) auf die
' Druckseite 1 (Druckbereich)
'Rectangel festlegen
Dim bounds As New Rectangle(BelegLocation.X, BelegLocation.Y, _
imageBounds.Width, imageBounds.Height)
Dim rectA = New Rectangle(BelegLocation.X + 200, txtALocation.Y, _
minSize.Width, minSize.Height)
Dim rectB = New Rectangle(BelegLocation.X + 300, txtBLocation.Y, _
minSize.Width, minSize.Height)
Dim rectC = New Rectangle(BelegLocation.X + 400, txtCLocation.Y, _
minSize.Width, minSize.Height)
Dim rectD = New Rectangle(BelegLocation.X + 500, txtCLocation.Y, _
minSize.Width, minSize.Height)
'Bildpfad prüfen
If IsBildPfad(bildpfad) = True Then
Dim img As Bitmap = GetZoomImage(Image.FromFile(bildpfad), New _
Size(imageBounds), InterpolationMode.HighQualityBicubic)
e.Graphics.DrawString("Belegnummer-N.N." & Format(i, _
"000000000000"), textFont, Brushes.Blue, bounds, textFormat)
'e.Graphics.DrawImage(img, bounds) 'passt sauber ins Rect
BelegLocation.Y += imageBounds.Height + height
e.Graphics.DrawRectangle(pen_gray, bounds) 'nur für Testzwecke
'txtA
txtALocation.Y += imageBounds.Height + height
e.Graphics.DrawString("SpalteA-" & Format(i, "0000"), textFont, _
Brushes.Blue, rectA, textFormat)
e.Graphics.DrawRectangle(pen_gray, rectA)
'----------------------------------------
'txtB
txtBLocation.Y += imageBounds.Height + height
e.Graphics.DrawString("SpalteB-" & Format(i, "0000"), textFont, _
Brushes.Blue, rectB, textFormat)
e.Graphics.DrawRectangle(pen_gray, rectB)
'----------------------------------------
'txtC
txtCLocation.Y += imageBounds.Height + height
e.Graphics.DrawString("SpalteC-" & Format(i, "0000"), textFont, _
Brushes.Blue, rectC, textFormat)
e.Graphics.DrawRectangle(pen_gray, rectC)
'----------------------------------------
'txtD
txtDLocation.Y += imageBounds.Height + height
e.Graphics.DrawString("SpalteD-" & Format(i, "0000"), textFont, _
Brushes.Blue, rectD, textFormat)
e.Graphics.DrawRectangle(pen_gray, rectD)
'----------------------------------------
'Trennlinie
g.DrawLine(p1, imageBounds.Width + 100, BelegLocation.Y - _
height, 718, BelegLocation.Y - height)
Else
Dim img As Bitmap = GetZoomImage(Image.FromFile(testBild), New _
Size(imageBounds), InterpolationMode.HighQualityBicubic)
'trifft zu wenn kein Beleg zugewiesen wurde (Pfad = leer)
e.Graphics.DrawString("kein Beleg-N.N." & Format(i, _
"000000000000"), textFont, Brushes.Blue, bounds, textFormat)
'e.Graphics.DrawImage(img, bounds) 'passt sauber ins Rect
BelegLocation.Y += imageBounds.Height + height
e.Graphics.DrawRectangle(pen_gray, bounds) 'nur für Testzwecke
'Trennlinie
g.DrawLine(p1, imageBounds.Width + 100, BelegLocation.Y - _
height, 718, BelegLocation.Y - height)
End If
Next
If rect_Druckbereich.Height < BelegLocation.Y Then
e.HasMorePages = True
PosY += 30
DruckSeite += 1
Else
e.HasMorePages = False
DruckSeite = 0
End If
textFont.Dispose()
textFormat.Dispose()
End Sub |