Hallo Urot,
ich habe den Ausdruck auch über ein Basissystem probiert - klappt problemlos. Nur beim Kunden nicht. Es muss wohl irgendwo beim Kunden liegen (Update Framework?...). Trotzdem der Code:
Private Sub pdGrafik_PrintPage(ByVal sender As System.Object, ByVal e As _
System.Drawing.Printing.PrintPageEventArgs) Handles pdGrafik.PrintPage
Dim Nummer As Integer = 1
Dim Vertikale As Integer = 4
'Einstellen auf Millimeter
e.Graphics.PageUnit = GraphicsUnit.Millimeter
'Pen für Linien
Dim Pen As System.Drawing.Pen
Pen = New System.Drawing.Pen(System.Drawing.Color.Black, 0.1)
'Variablen deklarieren
Dim lbreite As Single = 180 'entspricht 16cm auf DIN A4
Dim fntFont As New Font("Arial", 10)
Dim Abstandlinks As Integer = 19 '3mm VB-Problem beseitigen, sonst 22
Dim strMaxDiff As String = "Maximale Differenz der Innenfeuchte: "
Dim fntFont2 As New Font("Arial", 8)
Dim fntFont3 As New Font("Arial", 7, FontStyle.Bold)
Dim fntFont4 As New Font("Arial", 5, FontStyle.Regular)
Dim zahl As Integer = 135 'Zahlzähler Abstand
'Direkthilfe-Logo zeichnen
Dim img As Image = Form1.Instanz.PictureBox2.Image
Dim bmp As New Bitmap(20, 10) '// <<< Größe angeben
Dim gr As Graphics = Graphics.FromImage(bmp)
e.Graphics.DrawImage(img, New RectangleF(Abstandlinks, 10, bmp.Width - _
3, bmp.Height), _
New RectangleF(0, 0, img.Size.Width, _
img.Size.Height), _
GraphicsUnit.Pixel)
'Datum des Ausdrucks
e.Graphics.DrawString(Now, fntFont, New SolidBrush(Color.Black), 147, _
15)
'Seitenlinien
'Oberste Linie
e.Graphics.DrawLine(Pen, Abstandlinks, 20, lbreite, 20)
'Maximale Differenz der Innenfeuchte
e.Graphics.DrawString(strMaxDiff & Form1.Instanz.txtMaxDiff.Text & "" & _
"g/kg", fntFont, New SolidBrush(Color.Black), Abstandlinks, 30)
'Legende
'-Innenfeuchte-
Dim PenRot As System.Drawing.Pen
PenRot = New System.Drawing.Pen(System.Drawing.Color.Red, 0.5)
e.Graphics.FillEllipse(Brushes.Red, 147, 30, 2, 2)
e.Graphics.DrawLine(PenRot, 147, 31, 155, 31)
e.Graphics.DrawString("= Innenfeuchte", fntFont3, New SolidBrush( _
Color.Black), 156, 29.5)
'-Aussenfeuchte-
Dim PenGruen As System.Drawing.Pen
PenGruen = New System.Drawing.Pen(System.Drawing.Color.Green, 0.5)
e.Graphics.FillRectangle(Brushes.Green, 147, 35, 2, 2)
e.Graphics.DrawLine(PenGruen, 147, 36, 155, 36)
e.Graphics.DrawString("= Außenfeuchte", fntFont3, New SolidBrush( _
Color.Black), 156, 34.5)
'Chart einfügen
Dim chartImg As Image = Form1.Instanz.chart.GetImage
Dim bmp2 As New Bitmap(200, 100) '// <<< Größe angeben
Dim gr2 As Graphics = Graphics.FromImage(bmp2)
e.Graphics.DrawImage(chartImg, New RectangleF(Abstandlinks, 30, _
bmp2.Width, bmp2.Height), _
New RectangleF(0, 0, chartImg.Size.Width + 80, _
chartImg.Size.Height), _
GraphicsUnit.Pixel)
'Wertetabelle einfügen
'---Überschriften der Wertetabelle---
'----Hintergrund Grau---
'Füllung
e.Graphics.FillRectangle(Brushes.LightGray, Abstandlinks, 130, 161, 4)
'Überstrich Überschriften
e.Graphics.DrawLine(Pen, Abstandlinks, 130, lbreite, 130)
e.Graphics.DrawString("Nr.", fntFont2, New SolidBrush(Color.Black), _
Abstandlinks, 130)
e.Graphics.DrawString("Gebäudebezeichnung", fntFont2, New SolidBrush( _
Color.Black), Abstandlinks + 6, 130)
e.Graphics.DrawString("Raumbezeichnung", fntFont2, New SolidBrush( _
Color.Black), Abstandlinks + 39, 130)
e.Graphics.DrawString("ti°C", fntFont2, New SolidBrush(Color.Black), _
Abstandlinks + 68, 130)
e.Graphics.DrawString("rFi.%", fntFont2, New SolidBrush(Color.Black), _
Abstandlinks + 76, 130)
e.Graphics.DrawString("xi[g/kg]", fntFont2, New SolidBrush( _
Color.Black), Abstandlinks + 86, 130)
e.Graphics.DrawString("ta°C", fntFont2, New SolidBrush(Color.Black), _
Abstandlinks + 98, 130)
e.Graphics.DrawString("rFa.%", fntFont2, New SolidBrush(Color.Black), _
Abstandlinks + 106, 130)
e.Graphics.DrawString("xa [g/kg]", fntFont2, New SolidBrush( _
Color.Black), Abstandlinks + 116, 130)
e.Graphics.DrawString("Tag", fntFont2, New SolidBrush(Color.Black), _
Abstandlinks + 136, 130)
e.Graphics.DrawString("Zeit", fntFont2, New SolidBrush(Color.Black), _
Abstandlinks + 152, 130)
... 'Mangels Platz habe ich den Rest hier weggelassen
End SubMarcus
Always change a running system...or you will never learn! |