VB求代码过程!
答案:3 悬赏:60 手机版
解决时间 2021-02-09 19:55
- 提问者网友:雾里闻花香
- 2021-02-09 12:28
VB求代码过程!
最佳答案
- 五星知识达人网友:你哪知我潦倒为你
- 2021-02-09 13:06
Const pi = 3.14
Dim r As Single
Private Sub Command1_Click()
r = Text1.Text
Label3.Caption = 2 * pi * r
End Sub
Private Sub Command2_Click()
r = Text1.Text
Label5.Caption = pi * r * r
End Sub
Dim r As Single
Private Sub Command1_Click()
r = Text1.Text
Label3.Caption = 2 * pi * r
End Sub
Private Sub Command2_Click()
r = Text1.Text
Label5.Caption = pi * r * r
End Sub
全部回答
- 1楼网友:老鼠爱大米
- 2021-02-09 14:19
Private Sub Command1_Click()
Label1 = Val(Text1) * 3.14 * 2
End Sub
Private Sub Command2_Click()
Label2 = Val(Text1) ^ 2 * 3.14
End Sub
Label1 = Val(Text1) * 3.14 * 2
End Sub
Private Sub Command2_Click()
Label2 = Val(Text1) ^ 2 * 3.14
End Sub
- 2楼网友:怙棘
- 2021-02-09 14:01
Const Pi As Double = 3.14
Private Sub Command1_Click()
Label3.Alignment = 0
Label3.Caption = 2 * Pi * Val(Text1.Text)
End Sub
Private Sub Command2_Click()
Label5.Alignment = 0
Label5.Caption = Pi * Val(Text1.Text) ^ 2
End Sub
Private Sub Form_Activate()
Form1.Caption = "计算圆的周长和面积"
Label1.Alignment = 1
Label1.Caption = "在此输入圆的半径"
Label2.Alignment = 1
Label2.Caption = "圆的周长"
Label4.Caption = "圆的面积"
Command1.Caption = "计算周长"
Command2.Caption = "计算面积"
Label3.Caption = ""
Label5.Caption = ""
Text1.Text = ""
End Sub
Private Sub Command1_Click()
Label3.Alignment = 0
Label3.Caption = 2 * Pi * Val(Text1.Text)
End Sub
Private Sub Command2_Click()
Label5.Alignment = 0
Label5.Caption = Pi * Val(Text1.Text) ^ 2
End Sub
Private Sub Form_Activate()
Form1.Caption = "计算圆的周长和面积"
Label1.Alignment = 1
Label1.Caption = "在此输入圆的半径"
Label2.Alignment = 1
Label2.Caption = "圆的周长"
Label4.Caption = "圆的面积"
Command1.Caption = "计算周长"
Command2.Caption = "计算面积"
Label3.Caption = ""
Label5.Caption = ""
Text1.Text = ""
End Sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯