📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "例[7-8] 自定义数组的应用"
ClientHeight = 2070
ClientLeft = 45
ClientTop = 330
ClientWidth = 6075
LinkTopic = "Form1"
ScaleHeight = 2070
ScaleWidth = 6075
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "结束"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Index = 5
Left = 4920
TabIndex = 15
Top = 1440
Width = 972
End
Begin VB.CommandButton Command1
Caption = "最高分"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Index = 4
Left = 3720
TabIndex = 14
Top = 1440
Width = 972
End
Begin VB.CommandButton Command1
Caption = "后一个"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Index = 3
Left = 2520
TabIndex = 13
Top = 1440
Width = 972
End
Begin VB.CommandButton Command1
Caption = "前一个"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Index = 2
Left = 1320
TabIndex = 12
Top = 1440
Width = 972
End
Begin VB.CommandButton Command1
Caption = "添加"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Index = 1
Left = 120
TabIndex = 11
Top = 1440
Width = 972
End
Begin VB.TextBox Text5
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 324
Left = 4560
TabIndex = 10
Text = " "
Top = 840
Width = 972
End
Begin VB.TextBox Text4
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 324
Left = 2640
TabIndex = 9
Text = " "
Top = 840
Width = 972
End
Begin VB.TextBox Text3
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 324
Left = 720
TabIndex = 8
Text = " "
Top = 840
Width = 972
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 324
Left = 2640
TabIndex = 7
Text = " "
Top = 240
Width = 972
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 324
Left = 720
TabIndex = 6
Text = " "
Top = 240
Width = 972
End
Begin VB.Label Label6
BeginProperty Font
Name = "隶书"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3840
TabIndex = 5
Top = 240
Width = 2055
End
Begin VB.Label Label5
Caption = "数学:"
BeginProperty Font
Name = "隶书"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 3960
TabIndex = 4
Top = 840
Width = 648
End
Begin VB.Label Label4
Caption = "英语:"
BeginProperty Font
Name = "隶书"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 2040
TabIndex = 3
Top = 840
Width = 648
End
Begin VB.Label Label3
Caption = "语文:"
BeginProperty Font
Name = "隶书"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 120
TabIndex = 2
Top = 840
Width = 732
End
Begin VB.Label Label2
Caption = "姓名:"
BeginProperty Font
Name = "隶书"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 2040
TabIndex = 1
Top = 240
Width = 648
End
Begin VB.Label Label1
Caption = "学号:"
BeginProperty Font
Name = "隶书"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 250
Left = 120
TabIndex = 0
Top = 240
Width = 650
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(Index As Integer)
Dim j%
Static stud(1 To 35) As StdType
Static n%, i%, Max!, Maxi%
Select Case Index
Case 1
i = n + 1
If i <= 35 Then
With stud(i)
.No = Text1: .Name = Text2: .Score(1) = Text3
.Score(2) = Text4: .Score(3) = Text5
.Total = .Score(1) + .Score(2) + .Score(3)
End With
Text1 = "": Text2 = "": Text3 = "": Text4 = "": Text5 = ""
Label6 = ""
Text1.SetFocus
n = i
Else
MsgBox "输入人数超过数组声明的个数(35)"
Command1(1).Enabled = False
End If
Case 2 To 3
If Index = 2 And i > 1 Then i = i - 1
If Index = 3 And i < n Then i = i + 1
With stud(i)
Text1 = .No: Text2 = .Name: Text3 = .Score(1): Text4 = .Score(2)
Text5 = .Score(3): Label6 = "总分:" + Str(.Total)
End With
Case 4
Max = stud(1).Total
Maxi = 1
For j = 2 To n
If stud(j).Total > Max Then
Max = stud(j).Total
Maxi = j
End If
Next j
With stud(Maxi)
Text1 = .No: Text2 = .Name
Text3 = .Score(1): Text4 = .Score(2): Text5 = .Score(3)
Label6 = "总分" & Str(.Total) & " 位置" & Maxi & " / " & n
End With
Case 5
End
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -