c = Val(Text3.Text) d = Val(Text4.Text) n = a * a + b * b m = c * c + d * d r = Sqr(n)
If Option1.Value = True Then
If a < 0 Or b < 0 Or c < 0 Or d < 0 Then
ans = MsgBox(\出错了,起点、终点坐标不在同一象限内,请重新输入\提示信息\ End If End If
If Option2.Value = True Then
If a > 0 Or b < 0 Or c > 0 Or d < 0 Then
ans = MsgBox(\出错了,起点、终点坐标不在同一象限内,请重新输入\提示信息\ End If End If
If Option3.Value = True Then
If a > 0 Or b > 0 Or c > 0 Or d > 0 Then
ans = MsgBox(\出错了,起点、终点坐标不在同一象限内,请重新输入\提示信息\ End If End If
If Option4.Value = True Then
If a < 0 Or b > 0 Or c < 0 Or d > 0 Then
ans = MsgBox(\出错了,起点、终点坐标不在同一象限内,请重新输入\提示信息\ End If End If
Picture1.ForeColor = vbRed Picture1.DrawWidth = 4 Const PI = 3.1415926535
If Option1.Value = True Then If a > c And b < d Then
If Option1.Value = True Then If b = 0 Then If c = 0 Then
Picture1.Circle (4500, 4500), r * 300, , 0 * 3.14159, 3.14159 / 2 Else
Picture1.Circle (4500, 4500), r * 300, , 0 * 3.14159, 3.14159 / 2 - Atn(d / c) End If
ElseIf c = 0 Then
Picture1.Circle (4500, 4500), r * 300, , Atn(b / a), 3.14159 / 2 Else
Picture1.Circle (4500, 4500), r * 300, , Atn(b / a), 3.14159 / 2 - Atn(d / c) End If End If
ElseIf a < c And b > d Then
If Option1.Value = True Then If a = 0 Then If d = 0 Then
Picture1.Circle (4500, 4500), r * 300, , 0 * 3.14159, 3.14159 / 2 Else
Picture1.Circle (4500, 4500), r * 300, , Atn(d / c), 3.14159 / 2 End If
ElseIf d = 0 Then
Picture1.Circle (4500, 4500), r * 300, , 0 * 3.14159, Atn(b / a) Else
Picture1.Circle (4500, 4500), r * 300, , Atn(d / c), Atn(b / a) End If End If Else
ans = MsgBox(\出错了,起点或终点坐标位置错误,请重新输入\提示信息\ End If End If
If Option2.Value = True Then If a > c And b > d Then
If Option2.Value = True Then If a = 0 Then If d = 0 Then
Picture1.Circle (4500, 4500), r * 300, , 3.14159 / 2, 3.14159 Else
Picture1.Circle (4500, 4500), r * 300, , 3.14159 / 2, 3.14159 - Atn(-d / c)
End If
ElseIf d = 0 Then
Picture1.Circle (4500, 4500), r * 300, , 3.14159 / 2 + Atn(-a / b), 3.14159 Else
Picture1.Circle (4500, 4500), r * 300, , 3.14159 / 2 + Atn(-a / b), -Atn(-d / c) + 3.14159 End If End If
ElseIf a < c And b < d Then If Option2.Value = True Then If b = 0 Then If c = 0 Then
Picture1.Circle (4500, 4500), r * 300, , 3.14159 / 2, 3.14159 Else
Picture1.Circle (4500, 4500), r * 300, , Atn(-c / d), 3.14159 End If
ElseIf c = 0 Then
Picture1.Circle (4500, 4500), r * 300, , 3.14159 / 2, 3.14159 - Atn(-b / a) Else
Picture1.Circle (4500, 4500), r * 300, , Atn(-c / d), 3.14159 - Atn(-b / a) End If End If Else
ans = MsgBox(\出错了,起点或终点坐标位置错误,请重新输入\提示信息\ End If End If
If Option3.Value = True Then If a < c And b > d Then
If Option3.Value = True Then If b = 0 Then If c = 0 Then
Picture1.Circle (4500, 4500), r * 300, , 3.14159, 3 * 3.14159 / 2 Else
Picture1.Circle (4500, 4500), r * 300, , 3.14159, Atn(d / c) + 3.14159 End If
ElseIf c = 0 Then
Picture1.Circle (4500, 4500), r * 300, , Atn(b / a) + 3.14159, 3 * 3.14159 / 2
Else
Picture1.Circle (4500, 4500), r * 300, , Atn(b / a) + 3.14159, Atn(d / c) + 3.14159
End If End If
ElseIf a > c And b < d Then If Option3.Value = True Then If a = 0 Then If d = 0 Then
Picture1.Circle (4500, 4500), r * 300, , 3.14159, 3 * 3.14159 / 2 Else
Picture1.Circle (4500, 4500), r * 300, , 3.14159 + Atn(d / c), 2 * 3.14159 / 2
End If
ElseIf d = 0 Then
Picture1.Circle (4500, 4500), r * 300, , 3.14159, 3 * 3.14159 / 2 - Atn(a / b)
Else
Picture1.Circle (4500, 4500), r * 300, , Atn(d / c) + 3.14159, 3 * 3.14159 / 2 - Atn(a / b)
End If End If Else
ans = MsgBox(\出错了,起点或终点坐标位置错误,请重新输入\提示信息\ End If End If
If Option4.Value = True Then If a < c And b < d Then
If Option4.Value = True Then If a = 0 Then If d = 0 Then
Picture1.Circle (4500, 4500), r * 300, , 3 * 3.14159 / 2, 2 * 3.14159 Else
Picture1.Circle (4500, 4500), r * 300, , 3 * 3.14159 / 2, Atn(d / c) + 3.14159 * 2
End If
ElseIf d = 0 Then Picture1.Circle (4500, 4500), r * 300, , Atn(b / a) + 3.14159 * 2, 2 * 3.14159 Else
Picture1.Circle (4500, 4500), r * 300, , Atn(b / a) + 3.14159 * 2, Atn(d / c) + 3.14159 * 2 End If End If
ElseIf a > c And b > d Then If Option4.Value = True Then If b = 0 Then If c = 0 Then
Picture1.Circle (4500, 4500), r * 300, , 3 * 3.14159 / 2, 2 * 3.14159 Else
Picture1.Circle (4500, 4500), r * 300, , 3 * 3.14159 / 2 + Atn(-c / d), 2 * 3.14159 End If
ElseIf c = 0 Then
Picture1.Circle (4500, 4500), r * 300, , 3 * 3.14159 / 2, -Atn(-b / a) Else
Picture1.Circle (4500, 4500), r * 300, , 3 * 3.14159 / 2 + Atn(-c / d), -Atn(-b / a)
End If End If Else
ans = MsgBox(\出错了,起点或终点坐标位置错误,请重新输入\提示信息\ End If End If
End Sub
Private Sub 插补计算_Click()
Dim a, b, c, d, ni, mi, ai, bi, ci, k, f, g, m, n, l, i, xs, yx, xe, ye, jvx, jvy, xi, yi As Integer
Dim r As Single
a = Val(Text1.Text) b = Val(Text2.Text) c = Val(Text3.Text) d = Val(Text4.Text) ni = a * a + b * b mi = c * c + d * d r = Sqr(ni) form2.Cls
If Option1.Value = True Then
If a < 0 Or b < 0 Or c < 0 Or d < 0 Then
ans = MsgBox(\出错了,起点、终点坐标不在同一象限内,请重新输入\提示信息\ End If End If
If Option2.Value = True Then
If a > 0 Or b < 0 Or c > 0 Or d < 0 Then
ans = MsgBox(\出错了,起点、终点坐标不在同一象限内,请重新输入\提示信息\ End If End If
If Option3.Value = True Then
If a > 0 Or b > 0 Or c > 0 Or d > 0 Then
ans = MsgBox(\出错了,起点、终点坐标不在同一象限内,请重新输入\提示信息\ End If End If
If Option4.Value = True Then
If a < 0 Or b > 0 Or c < 0 Or d > 0 Then
ans = MsgBox(\出错了,起点、终点坐标不在同一象限内,请重新输入\提示信息\ End If End If ci = 2 f = 1 g = 1
k = 0 '正X进给标志 1 正向 -1负向 m = 0 '负Y进给标志 1 正向 -1负向 n = 0 '累加次数
i = CInt(Text5) '寄存器位数赋给i l = 2 ^ i
xs = CInt(Text1)