1,453
社区成员
发帖
与我相关
我的任务
分享'以下示例列出所有Picture1内的控件
Private Function IsInside(ByVal SubControl As Control, ByVal Container As Control) As Boolean
Dim ctl As Control
Set ctl = SubControl
While Not ctl.Container Is Me
If ctl.Container Is Container Then
IsInside = True
Exit Function
End If
Set ctl = ctl.Container
Wend
End Function
Private Sub Command1_Click()
Dim ctl As Control
For Each ctl In Me.Controls
If IsInside(ctl, Picture1) Then
Debug.Print ctl.Name
End If
Next
End Sub