Ok soweit richtig...
hier mal folgenden Auszug aus meinem Paint Event:
Dim p As New Pen(Brushes.Black, 3)
Dim pl As New Pen(colors2)
Dim chartw As Single = 1200
Dim charth As Single = 850
Dim chartx As Single = (PictureBox1.Width - chartw) / 2
Dim charty As Single = (PictureBox1.Height - charth) / 2
cl1 = cl
Dim AnzahlDaten As Integer = ListBox1.Items.Count * 2 + 1
Dim Balkenw As Single = chartw / AnzahlDaten
Dim temp As Single = Runden((Math.Ceiling(max / 100)) * 100, 0)
Dim Skalahmeasure As Single = (charth / temp) * 100
Dim zähler As Integer = 1
xcor(0) = chartx + Balkenw / 2
For t As Integer = 0 To temp / 100
'Mittellinien
Dim p1 As New Point
Dim p2 As New Point
p1.X = chartx + Balkenw / 2
p1.Y = charty + charth - (t * Skalahmeasure)
p2.X = chartx + chartw - Balkenw / 2
p2.Y = charty + charth - (t * Skalahmeasure)
pl.DashStyle = Drawing2D.DashStyle.Dash
e.Graphics.DrawLine(pl, p1, p2)
If t Mod 2 = 0 Then
e.Graphics.DrawString(CStr(t * 100), getSFont(-2), _
Brushes.Black, p1.X - 50, p1.Y - 5)
Else
e.Graphics.DrawString(CStr(t * 100), getSFont(-2), _
Brushes.Black, p2.X + 20, p1.Y - 5)
End If
Next
'Linksbalken
e.Graphics.DrawLine(p, CInt(chartx) + Balkenw / 2, CInt(charty), _
CInt(chartx) + Balkenw / 2, CInt(charty + charth))
'Oberbalken
e.Graphics.DrawLine(p, CInt(chartx) + Balkenw / 2, CInt(charty), _
CInt(chartx + chartw) - Balkenw / 2, CInt(charty))
'Unterbalken
e.Graphics.DrawLine(p, CInt(chartx) + Balkenw / 2, CInt(charty + _
charth), CInt(chartx + chartw) - Balkenw / 2, CInt(charty + _
charth))
'Rechtsbalken
e.Graphics.DrawLine(p, CInt(chartx + chartw) - Balkenw / 2, CInt( _
charty), CInt(chartx + chartw) - Balkenw / 2, CInt(charty + _
charth))
For t As Integer = 0 To ListBox1.Items.Count - 1
Dim Balkenx As Single = chartx + (Balkenw * zähler)
Dim Balkenh As Single = (winkellist(t) * Skalahmeasure) / 100
Dim Balkeny As Single = charty + charth - Balkenh
Dim br As New SolidBrush(cl(t))
Dim MyStringFormat As New System.Drawing.StringFormat
MyStringFormat.FormatFlags = _
StringFormatFlags.DirectionRightToLeft
If (t + 1) Mod 2 = 0 Then
e.Graphics.DrawString(t + 1, getSFont(-2), Brushes.Black, _
Balkenx + (Balkenw / 2) + (MeasureString(Me, t + 1, _
getSFont(-2)) / 2), charty - 15, MyStringFormat)
Else
e.Graphics.DrawString(t + 1, getSFont(-2), Brushes.Black, _
Balkenx + (Balkenw / 2) + (MeasureString(Me, t + 1, _
getSFont(-2)) / 2), charty + charth + 5, MyStringFormat)
End If
e.Graphics.DrawString(winkellist(t), getSFont(-2), br, Balkenx _
+ (Balkenw / 2) + (MeasureString(Me, winkellist(t), getSFont( _
-2)) / 2), charty + charth - Balkenh - 15, MyStringFormat)
'Balken
e.Graphics.FillRectangle(br, Balkenx, Balkeny, Balkenw, Balkenh)
e.Graphics.DrawRectangle(Pens.Black, Balkenx, Balkeny, Balkenw, _
Balkenh)
Dim pline As New Point
Dim pline1 As New Point
pline.X = Balkenx + Balkenw * 1.5
pline.Y = charty
pline1.X = pline.X
pline1.Y = charty + charth
xcor(t + 1) = pline.X
pl.DashStyle = Drawing2D.DashStyle.DashDotDot
e.Graphics.DrawLine(pl, pline, pline1)
zähler += 2
Next
ycor(0) = charty
ycor(1) = charty + charth Gruss Caddy |