vb编程求助

2025-01-18 16:54:50
推荐回答(1个)
回答1:

Const pi = 3.14

Private Sub Command1_Click() '弧度转度
If IsNumeric(Text1.Text) Then
Text2.Text = Int(CSng(Text1.Text) / pi * 180 * 100 + 0.5) / 100
Else
MsgBox "请输入数字"
End If
End Sub

Private Sub Command2_Click() '度转弧度
If IsNumeric(Text1.Text) Then
Text2.Text = Int(CSng(Text1.Text) / 180 * pi * 100 + 0.5) / 100
Else
MsgBox "请输入数字"
End If
End Sub

Private Sub Form_Load()
Command1.Caption = "RAD-->DEG" '弧度转度
Command2.Caption = "DEG-->RAD" '度转弧度
End Sub