Public Class Form1
    Const G As Single = 9.81
    Const Pi As Single = 3.14
    Dim V0, A, S, L, H As Single
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Ввод начальных значений
        V0 = Val(TextBox1.Text)
        A = Val(TextBox2.Text)
        S = Val(TextBox3.Text)
        H = Val(TextBox4.Text)
        'Попадание в стенку
        L = S * Math.Tan(A * Pi / 180) - (G * S ^ 2) / (2 * V0 ^ 2 * Math.Cos(A * Pi / 180) ^ 2)
        Label12.Text = L
        Select Case L
            Case Is < 0
                Label13.Text = "Недолёт"
            Case Is > H
                Label13.Text = "Перелёт"
            Case Else
                Label13.Text = "Попадание"
        End Select
    End Sub
    Dim Graph1 As Graphics
    Dim Pen1 As New Pen(Color.Black, 4)
    Dim drawBrush As New SolidBrush(Color.Black)
    Dim drawFont As New Font("Arial", 10)
    Dim X, Y, T As Single
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Graph1 = Me.PictureBox1.CreateGraphics()
        Graph1.Clear(Color.White)
        'Печать шкал математической системы координат в компьютерной системе координат
        For X = 0 To 400 Step 50
            Graph1.DrawString(X / 10, drawFont, drawBrush, X, 200)
        Next X
        For Y = 20 To 220 Step 50
            Graph1.DrawString((Y - 20) / 10, drawFont, drawBrush, 0, 220 - Y)
        Next Y
        'Преобразование компьютерной системы координат в математическую систему координат
        Graph1.ScaleTransform(1, -1) 'Поворот оси Y 
        Graph1.TranslateTransform(0, -200) 'Сдвиг по оси Y 
        'Рисование осей математической системы координат
        Graph1.DrawLine(Pen1, 0, 0, 400, 0) 'Ось X 
        Graph1.DrawLine(Pen1, 0, -20, 0, 200) 'Ось Y
        'Стенка
        Graph1.DrawLine(Pen1, S * 10, 0, S * 10, H * 10)
        'Построение траектории движения мячика
        For T = 0 To 10 Step 0.1
            Y = V0 * Math.Sin(A * Pi / 180) * T - G * T * T / 2
            X = V0 * Math.Cos(A * Pi / 180) * T
            Graph1.DrawEllipse(Pen1, X * 10, Y * 10, 1, 1)
        Next T
    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub
End Class
