Forum: VB.NET |
Thema:
Drucken mit Printdocument |
Von:
G. Guest (
27.04.2005 16:33) |
Hallo,
ich benutze das Steuerelement Printdocument.
Habe folgenden Code:
Private Sub PrintDocument_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument.PrintPage
Dim gr As Graphics = e.Graphics
gr.PageUnit = GraphicsUnit.Millimeter
PrintHead(gr) 'hier wird der Kopf erstellt
PrintMain(gr) 'hier wird das Hauptformular erstellt
PrintValue(gr)'hier werden die Daten erstellt
End Sub
Private Sub PrintHead(ByVal Gr As Graphics)
Dim FntAr12 As New Font("arial", 12, FontStyle.Regular)
Dim FntAr12F As New Font("arial", 12, FontStyle.Bold)
Dim FntAr12U As New Font("arial", 12, FontStyle.Regular Or FontStyle.Underline)
Dim FntAr10F As New Font("arial", 10, FontStyle.Bold)
With Gr
Dim TextWidth As Integer = CInt(.MeasureString(Ort &", " & Now.ToString("dd. MMMM yyy"), FntAr12).Width)
Dim strFormat As StringFormat = New StringFormat
strFormat.Alignment = StringAlignment.Far
Dim rect As Rectangle = New Rectangle(182 - TextWidth, 27, TextWidth, 11)
.DrawString Ort &", " & Now.ToString("dd. MMMM yyy"), FntAr12, BlackB, RectangleF.op_Implicit(rect), strFormat)
.DrawString("Verteiler:", FntAr12U, BlackB, 22, 27)
Dim StepLine As Integer = 32
If Not IsNothing(MyDistributors) Then
For inti As Integer = 0 To MyDistributors.Count - 1
If inti = PCount Then
.DrawString(MyDistributors.Item(inti).Verteiler.ToString, FntAr12, BlackB, 22, StepLine)
Else
.DrawString(MyDistributors.Item(inti).Verteiler.ToString, FntAr12, BlackB, 22, StepLine)
End If
StepLine += 5
Next
End If
End With
FntAr12.Dispose()
FntAr12F.Dispose()
FntAr10F.Dispose()
FntAr12U.Dispose()
End Sub
Wie bekomme ich es hin, das ich 4 Seiten drucken kann. Im Kopf ist der Verteiler enthalten. Es sind vier ( soviel wie Ausdrucke ). Ich möchte in jeder gedruckten Seite einen anderen Verteiler grün drucken.
Vielen Dank für jede Hilfe
Antworten
Vorsicht bei der Eingabe: Die Zeichen ' oder -- sind nicht erlaubt!