- 'fonction pour tracer le graph
-
- Public Function gfx(pic As PictureBox, liste As ListBox, Max As Double, Moy As Double, lbl As Label)
- Dim lx As Double
- Dim ly As Double
- Dim i As Integer
- i = 0
- lx = (pic.Width / liste.ListCount)
- ly = pic.Height / Max
- Dim px2 As Double
- Dim py2 As Double
-
- 'la moyenne
- pic.DrawWidth = 4
- pic.Line (0, pic.Height - (ly * (Moy / liste.ListCount)))-(pic.Width, pic.Height - (ly * (Moy / liste.ListCount))), vbGreen
- lbl.Caption = Format(Moy / liste.ListCount, "##.000")
- lbl.Left = pic.Width - lbl.Width - 50
- lbl.Top = pic.Height - (ly * (Moy / liste.ListCount)) - lbl.Height - 10
-
- While i < liste.ListCount
- DoEvents
- Dim px As Double
- Dim py As Double
- px = lx * i - 1
- py = pic.Height - (ly * Val(liste.List(i)))
- 'ligne
- pic.DrawWidth = 2
- If i <> 1 Then
- pic.Line (px, py)-(px2, py2), vbBlue
- Else
- pic.Line (px, py)-(px - lx, pic.Height - (ly * Val(liste.List(i - 1)))), vbBlue
- End If
-
- If i <> 0 Then
- px2 = px
- py2 = py
- End If
- '#####
- pic.DrawWidth = 8
- pic.PSet (px, py), vbRed
- i = i + 1
- Wend
-
- End Function
-
'fonction pour tracer le graph
Public Function gfx(pic As PictureBox, liste As ListBox, Max As Double, Moy As Double, lbl As Label)
Dim lx As Double
Dim ly As Double
Dim i As Integer
i = 0
lx = (pic.Width / liste.ListCount)
ly = pic.Height / Max
Dim px2 As Double
Dim py2 As Double
'la moyenne
pic.DrawWidth = 4
pic.Line (0, pic.Height - (ly * (Moy / liste.ListCount)))-(pic.Width, pic.Height - (ly * (Moy / liste.ListCount))), vbGreen
lbl.Caption = Format(Moy / liste.ListCount, "##.000")
lbl.Left = pic.Width - lbl.Width - 50
lbl.Top = pic.Height - (ly * (Moy / liste.ListCount)) - lbl.Height - 10
While i < liste.ListCount
DoEvents
Dim px As Double
Dim py As Double
px = lx * i - 1
py = pic.Height - (ly * Val(liste.List(i)))
'ligne
pic.DrawWidth = 2
If i <> 1 Then
pic.Line (px, py)-(px2, py2), vbBlue
Else
pic.Line (px, py)-(px - lx, pic.Height - (ly * Val(liste.List(i - 1)))), vbBlue
End If
If i <> 0 Then
px2 = px
py2 = py
End If
'#####
pic.DrawWidth = 8
pic.PSet (px, py), vbRed
i = i + 1
Wend
End Function