Dim qi() As Label
Private Sub Form_Load()
ReDim qi(0 To 31)
For i = LBound(qi) To UBound(qi) Step 1
Set qi(i) = Controls.Add("vblabel", "label" & i)
With qi(i)
.Left = 100 ' 设置控件的位置
.Top = 100 + i * 30
.width = 50 ' 设置控件的大小
.height = 20
.Visible = True
.caption = "label " & i ' 设置控件的显示文本
End With
AddHandler qi(i).Click, AddressOf Shape_Click ' 添加Click事件处理程序
Next i
End Sub
我用代码生成了一个控件数组,但是我用不了控件的事件怎么办
VB6.0 好像不支持AddHandler qi(i).Click, AddressOf Shape_Click
Private Sub Form_Load()
ReDim qi(0 To 31)
For i = LBound(qi) To UBound(qi) Step 1
Set qi(i) = Controls.Add("vblabel", "label" & i)
With qi(i)
.Left = 100 ' 设置控件的位置
.Top = 100 + i * 30
.width = 50 ' 设置控件的大小
.height = 20
.Visible = True
.caption = "label " & i ' 设置控件的显示文本
End With
AddHandler qi(i).Click, AddressOf Shape_Click ' 添加Click事件处理程序
Next i
End Sub
我用代码生成了一个控件数组,但是我用不了控件的事件怎么办
VB6.0 好像不支持AddHandler qi(i).Click, AddressOf Shape_Click