【VB开源代码栏目提醒】:网学会员--在 VB开源代码编辑为广大网友搜集整理了:3.3.5.frm绩等信息,祝愿广大网友取得需要的信息,参考学习。
VERSION 5.00
Begin VB.Form Form7
Caption = "常量变量应用"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form7"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "周长"
Height = 495
Left = 2520
TabIndex = 2
Top = 1920
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "面积"
Height = 495
Left = 960
TabIndex = 1
Top = 1920
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
Left = 1920
TabIndex = 0
Text = "Text1"
Top = 480
Width = 1815
End
Begin
VB.Label Label1
Caption = "输入半径:"
Height = 375
Left = 720
TabIndex = 3
Top = 600
Width = 1095
End
End
Attribute VB_Name = "Form7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Const pi = 3.14159
'定义常量Pi
Private Sub Command1_Click()
'【面积】按钮
Dim s As Double
'定义变量s
s = pi * Text1.Text * Text1.Text
Text1.Text = s
'将计算结果显示在文本框中
Label1.Caption = "面积"
Text1.Refresh
'刷新文本框显示
End Sub
Private Sub Command2_Click()
'【周长】按钮
Dim s As Double
'定义变量s
s = pi * Text1.Text * 2
Text1.Text = s
Label1.Caption = "周长"
Text1.Refresh
End Sub