📄 文本框_平均值f2.frm
字号:
VERSION 5.00
Begin VB.Form frmArray
BackColor = &H80000009&
Caption = "在窗格内录入数据"
ClientHeight = 8820
ClientLeft = 60
ClientTop = 450
ClientWidth = 13275
LinkTopic = "Form1"
ScaleHeight = 8820
ScaleWidth = 13275
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdExit
Caption = "退出"
Height = 375
Left = 1440
TabIndex = 5
TabStop = 0 'False
Top = 0
Width = 735
End
Begin VB.CommandButton cmdPrint
Caption = "打印"
Height = 375
Left = 720
TabIndex = 4
TabStop = 0 'False
Top = 0
Width = 735
End
Begin VB.CommandButton cmdCalculate
Caption = "计算"
Height = 375
Left = 0
TabIndex = 2
TabStop = 0 'False
Top = 0
Width = 735
End
Begin VB.TextBox txtInput
Alignment = 2 'Center
Appearance = 0 'Flat
Height = 270
Index = 0
Left = 720
TabIndex = 0
Top = 600
Width = 735
End
Begin VB.Label lblCol
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
ForeColor = &H80000008&
Height = 255
Index = 0
Left = 720
TabIndex = 3
Top = 360
Width = 735
End
Begin VB.Label lblRow
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H80000005&
BorderStyle = 1 'Fixed Single
ForeColor = &H80000008&
Height = 255
Index = 0
Left = 0
TabIndex = 1
Top = 600
Width = 735
End
End
Attribute VB_Name = "frmArray"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'录入窗体
Option Explicit
Dim sngtxtHig As Single, sngtxtWid As Single
Dim intI As Integer, intJ As Integer
Private Sub Form_Load()
'使设计时安置在窗体的原型控件不可见
txtInput(0).Visible = False
lblRow(0).Visible = False
lblCol(0).Visible = False
'利用原型控件的坐标参数
sngtxtHig = txtInput(0).Height '控件元素的高度
sngtxtWid = txtInput(0).Width '控件元素的宽度
'形成文本框数组
For intI = 1 To intRow
For intJ = 1 To intCol
Load txtInput((intI - 1) * intCol + intJ)
txtInput((intI - 1) * intCol + intJ).Move _
txtInput(0).Left + (intJ - 1) * sngtxtWid, _
txtInput(0).Top + (intI - 1) * sngtxtHig
txtInput((intI - 1) * intCol + intJ).Visible = True
txtInput((intI - 1) * intCol + intJ).Text = ""
Next intJ
Next intI
'形成左边标签框,作行注释
For intI = 1 To intRow
Load lblRow(intI)
lblRow(intI).Move lblRow(0).Left, _
lblRow(0).Top + (intI - 1) * sngtxtHig
lblRow(intI).Visible = True
lblRow(intI).Caption = "第" & intI & "行"
Next intI
'形成上边标签框,作列注释
For intI = 1 To intCol
Load lblCol(intI)
lblCol(intI).Move lblCol(0).Left + (intI - 1) * sngtxtWid, _
lblCol(0).Top
lblCol(intI).Visible = True
lblCol(intI).Caption = "第" & intI & "列"
Next intI
End Sub
'打印数据
Private Sub cmdPrint_Click()
For intI = 1 To intRow
Printer.Print
For intJ = 1 To intCol
Printer.Print txtInput((intI - 1) * intCol + intJ).Text; "; ";
Next intJ
Next intI
Printer.EndDoc '执行打印
End Sub
'形成数组
Private Sub cmdCalculate_Click()
For intI = 1 To intRow
For intJ = 1 To intCol
'将录入的文本框数据送入数组
dblArray(intI, intJ) = txtInput((intI - 1) * intCol + intJ)
Next intJ
Next intI
Unload Me
frmResult.Show
End Sub
'退出
Private Sub cmdExit_Click()
Unload Me
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -