pexam5_3.frm
来自「深圳大学的vb上机与教学的课件」· FRM 代码 · 共 123 行
FRM
123 行
VERSION 5.00
Begin VB.Form Form1
Caption = "温度转换"
ClientHeight = 2445
ClientLeft = 60
ClientTop = 345
ClientWidth = 4995
LinkTopic = "Form1"
ScaleHeight = 2445
ScaleWidth = 4995
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "转换成摄氏温度为"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 3
Top = 720
Width = 2655
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2880
TabIndex = 1
Top = 720
Width = 1935
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2880
TabIndex = 0
Top = 240
Width = 1935
End
Begin VB.Label Label2
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "Label2"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 285
Left = 2040
TabIndex = 4
Top = 1680
Width = 1035
End
Begin VB.Label Label1
Caption = "请输入华氏温度:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 360
TabIndex = 2
Top = 240
Width = 2460
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
C = 5 / 9 * (Val(Text1.Text) - 32)
Text2.Text = Format(C, "0.00") ' 将转换结果保留两位小数显示
If C > 40 Then
Label2.Caption = "HOT"
ElseIf C > 30 And C <= 40 Then
Label2.Caption = "WARM"
ElseIf C > 20 And C <= 30 Then
Label2.Caption = "ROOM TEMPERATURE"
ElseIf C > 10 And C <= 20 Then
Label2.Caption = "COOL"
ElseIf C > 0 And C <= 10 Then
Label2.Caption = "COLD"
Else
Label2.Caption = "FREEZING"
End If
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?