📄 form0601_2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
Caption = "计算三角形斜边"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form2"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text3
Height = 495
Left = 1920
TabIndex = 6
Top = 1440
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "计算"
Height = 495
Left = 1680
TabIndex = 4
Top = 2280
Width = 1095
End
Begin VB.TextBox Text2
Height = 495
Left = 3360
TabIndex = 1
Top = 600
Width = 975
End
Begin VB.TextBox Text1
Height = 495
Left = 1200
TabIndex = 0
Top = 600
Width = 975
End
Begin VB.Label Label3
Caption = "斜边 c ="
Height = 375
Left = 960
TabIndex = 5
Top = 1560
Width = 735
End
Begin VB.Label Label2
Caption = "b="
Height = 375
Left = 2760
TabIndex = 3
Top = 600
Width = 495
End
Begin VB.Label Label1
Caption = "a="
Height = 375
Left = 480
TabIndex = 2
Top = 600
Width = 495
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public Function Function1(ByVal a As Single, ByVal b As Single) As Single
'计算直角斜边函数
Dim c As Single
c = Sqr(a ^ 2 + b ^ 2)
Function1 = c
End Function
Private Sub Command1_Click()
'计算斜边
Dim a1 As Single, b1 As Single
a1 = Val(Text1.Text)
b1 = Val(Text2.Text)
Text3.Text = Function1(a1, b1)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -