'加入一个Image控件
Public Sub AddImage_Ld(ByVal lngIndex As Integer, ByVal Tier As Long, ByVal Row As Long, ByVal bj As String)
If lngIndex < 1000 Then '如果要把1000值改动,就要连窗体ctlz这个控件里的INDEX值改动
'新增控件
If UserControl.CtLd(lngIndex) Is Nothing Then
Load UserControl.CtLd(lngIndex)
'设置大小,位置
UserControl.CtLd(lngIndex).Top = 20 + Tier
UserControl.CtLd(lngIndex).Left = 20 + Row
UserControl.CtLd(lngIndex).Height = 300
UserControl.CtLd(lngIndex).Width = 285
'设置是否显示
UserControl.CtLd(lngIndex).Visible = True
'设置背景色
'UserControl.CtLd(lngIndex).BackColor = &HFF8080
'MsgBox UserControl.CtLd(lngIndex).Top & "-" & UserControl.CtLd(lngIndex).Left & "-" & UserControl.CtLd(lngIndex).Visible
UserControl.CtLd(lngIndex).Picture = LoadPicture(bj)
Else 上面的不管数组控件是否存在,它都直接运行这句,所以就报错了不存在这个数组控件
Unload UserControl.CtLd(lngIndex)
End If
Else
MsgBox "数组控件不能大于1000"
Exit Sub
End If
End Sub
Public Sub AddImage_Ld(ByVal lngIndex As Integer, ByVal Tier As Long, ByVal Row As Long, ByVal bj As String)
If lngIndex < 1000 Then '如果要把1000值改动,就要连窗体ctlz这个控件里的INDEX值改动
'新增控件
If UserControl.CtLd(lngIndex) Is Nothing Then
Load UserControl.CtLd(lngIndex)
'设置大小,位置
UserControl.CtLd(lngIndex).Top = 20 + Tier
UserControl.CtLd(lngIndex).Left = 20 + Row
UserControl.CtLd(lngIndex).Height = 300
UserControl.CtLd(lngIndex).Width = 285
'设置是否显示
UserControl.CtLd(lngIndex).Visible = True
'设置背景色
'UserControl.CtLd(lngIndex).BackColor = &HFF8080
'MsgBox UserControl.CtLd(lngIndex).Top & "-" & UserControl.CtLd(lngIndex).Left & "-" & UserControl.CtLd(lngIndex).Visible
UserControl.CtLd(lngIndex).Picture = LoadPicture(bj)
Else 上面的不管数组控件是否存在,它都直接运行这句,所以就报错了不存在这个数组控件
Unload UserControl.CtLd(lngIndex)
End If
Else
MsgBox "数组控件不能大于1000"
Exit Sub
End If
End Sub
dim c as object
dim b as boolean
for each c in UserControl
if b=(c.index=lngIndex) then exit for
next
'然后判断b
If not b Then
Load UserControl.CtLd(lngIndex)
'.......
end if
dim c as object
dim b as boolean
for each c in UserControl.CtLd
if b=(c.index=lngIndex) then exit for
next
'然后判断b
If not b Then
Load UserControl.CtLd(lngIndex)
'.......
end if
dim b as boolean
for each c in UserControl.CtLd
b=(c.index=lngIndex)
if b then exit for
next
'然后判断b
If not b Then
Load UserControl.CtLd(lngIndex)
'.......
end if
就这个思路...唉 老了...