📄 5-11.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4110
ClientLeft = 60
ClientTop = 405
ClientWidth = 6900
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 4110
ScaleWidth = 6900
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "生成并计算"
Height = 615
Left = 360
TabIndex = 2
Top = 3000
Width = 1935
End
Begin VB.TextBox Text1
Height = 1695
Left = 240
MultiLine = -1 'True
TabIndex = 1
Top = 960
Width = 3615
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "Label2"
Height = 315
Left = 4200
TabIndex = 3
Top = 720
Width = 990
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "5×5数组:"
Height = 315
Left = 360
TabIndex = 0
Top = 480
Width = 1590
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()
Dim a%(5, 5), i%, j%, sum%
Randomize
Text1.Text = ""
sum = 0
For i = 1 To 5
For j = 1 To 5
a(i, j) = Int(Rnd * 40) + 1
If i = j Or i + j = 6 Then sum = sum + a(i, j)
Text1.Text = Text1.Text & Format(a(i, j), "@@@@")
Next j
Text1.Text = Text1.Text & vbCrLf
Next i
Label2.Caption = "对角线元素" & vbCrLf & "之和=" & sum
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -