一次创建多个label 数组控件
Option ExplicitDim labjs As Long
Private Sub Command1_Click()
Dim Label1() As Label
labjs = 1
labjs = labjs + 1
Load Label1(labjs)
With Label1(labjs)
.Caption = labjs
.Visible = True
End With
Call label1move
End Sub
Private Sub Label1_Click()
Index As Integer
Unload Label1(Index)
Call label1move
End Sub
Private Sub label1move()
Dim k As Label
Dim x As Long, y As Long
x = 0
y = 0
For Each k In Label1
k.Move x, y
x = x + k.Width
If x + k.Width > Me.ScaleWidth Then
y = y + k.Height
x = 0
End If
Next
End Sub
提示下标越界