Private Sub Rysuj(ByVal e As PictureBox, ByVal Arr As Array, ByVal H As Array, ByVal Steps As Integer, ByVal TimeStep As Double, ByVal SimTime As Double, ByVal n As Integer)
Dim g As Graphics = e.CreateGraphics
'Dim j As
Dim kk As Double
H = Arr.Clone
Array.Sort(H)
Dim MaxArr As Double = H.GetValue(CInt(Steps - 1))
Dim MinArr As Double = H.GetValue(0)
If Math.Abs(MinArr) > MaxArr Then
kk = MinArr
g.DrawString(CStr(MinArr), Font3, Brushes.Red, xPos + 12, yPos + (yRectSize + 10) * n + 120)
kk = Math.Abs(MinArr)
g.DrawLine(Pens.Red, xPos + 8, yPos + (yRectSize + 10) * n + 15 + 120, xPos + 12, yPos + (yRectSize + 10) * n + 15 + 120)
Else
kk = Math.Abs(MaxArr)
g.DrawString(CStr(MaxArr), Font3, Brushes.Red, xPos + 12, yPos + (yRectSize + 10) * n)
g.DrawLine(Pens.Red, xPos + 8, yPos + (yRectSize + 10) * n + 15, xPos + 12, yPos + (yRectSize + 10) * n + 15)
End If
If kk = 0 Then
kk = 1
End If
For k As Integer = 0 To CInt(Steps - 2)
If Arr(k + 1) > 10000000000 Then
k = CInt(Steps - 3)
MsgBox("Overflow")
End If
g.DrawLine(Pens.Blue, CInt(xPos + 10 + k * TimeStep * xRectSize / SimTime), CInt(yPos + (yRectSize + 10) * n + yRectSize / 2 - Arr(k) * 120 / kk), CInt(xPos + 10 + (k + 1) * TimeStep * xRectSize / SimTime), CInt(yPos + (yRectSize + 10) * n + yRectSize / 2 - Arr(k + 1) / kk * 120))
Next k
End Sub