VB控件数组的题目,十万火急
首先创建控件数组元素Text1(0),运行的时候,单击“生成界面”按钮用输入框输入一个N值,按该N值在界面生成具有N个元素的控件数组Text1,并在Text1(0)到te...
首先创建控件数组元素Text1(0),运行的时候,单击“生成界面”按钮用输入框输入一个N值,按该N值在界面生成具有N个元素的控件数组Text1,并在Text1(0)到text1(N)中显示出来(一个text框显示一个数字),同时调整好窗体的宽度。
书上提示是用 load text1(1)但是我不能将各个数字放入各个控件text里面 展开
书上提示是用 load text1(1)但是我不能将各个数字放入各个控件text里面 展开
1个回答
展开全部
'初始化程序
Private Sub Form_Load()
Dim i, j, k As Integer
Speed = 500 '初始速度
Picture1.Height = 4060
Picture1.Width = 2060
Picture2.Height = 824
Picture2.Width = 824
'游戏窗口初始化
For i = 0 To 19
For j = 0 To 9
k = 10 * i + j
If k <> 0 Then
Load Image1(k)
End If
Image1(k).Visible = False
Image1(k).Height = 200
Image1(k).Width = 200
Image1(k).Top = 200 * i
Image1(k).Left = 200 * j
Next
Next
'提示窗口初始化
For i = 0 To 3
For j = 0 To 3
k = 4 * i + j
If k <> 0 Then
Load Image2(k)
End If
Image2(k).Visible = False
Image2(k).Height = 200
Image2(k).Width = 200
Image2(k).Top = 200 * i
Image2(k).Left = 200 * j
Next
Next
'初始化一些值
Grade = 1
Timer1.Enabled = False
Timer1.Interval = Speed
Call Randnumber
Bool = True
statue = True
score = 0
Label1.Caption = "成绩:" & score
End Sub
这是个实例代码 你参考下改下就行了
Private Sub Form_Load()
Dim i, j, k As Integer
Speed = 500 '初始速度
Picture1.Height = 4060
Picture1.Width = 2060
Picture2.Height = 824
Picture2.Width = 824
'游戏窗口初始化
For i = 0 To 19
For j = 0 To 9
k = 10 * i + j
If k <> 0 Then
Load Image1(k)
End If
Image1(k).Visible = False
Image1(k).Height = 200
Image1(k).Width = 200
Image1(k).Top = 200 * i
Image1(k).Left = 200 * j
Next
Next
'提示窗口初始化
For i = 0 To 3
For j = 0 To 3
k = 4 * i + j
If k <> 0 Then
Load Image2(k)
End If
Image2(k).Visible = False
Image2(k).Height = 200
Image2(k).Width = 200
Image2(k).Top = 200 * i
Image2(k).Left = 200 * j
Next
Next
'初始化一些值
Grade = 1
Timer1.Enabled = False
Timer1.Interval = Speed
Call Randnumber
Bool = True
statue = True
score = 0
Label1.Caption = "成绩:" & score
End Sub
这是个实例代码 你参考下改下就行了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询