控件数组的响应事件无效!求救!
控件数组的响应事件无效,翻了很多帖子还是没有头绪,请帮忙!
class module
Option Explicit
Private WithEvents mShape As Shape
Public Property Set MsShape(ByVal vData As Shape)
Set mShape = vData
End Property
Public Property Get MsShape() As Shape
Set MsShape = mShape
End Property
Private Sub mShape_Click()
MsgBox mShape.Name
End Sub
调用:
Public Sub CreateShape(i As Integer)
Set a(i) = New Class1
Set a(i).MsShape = Controls.Add("VB.Shape", "oShape" & i, Form1)
a(i).MsShape.Visible = True
a(i).MsShape.Left = 5000
a(i).MsShape.Top = 5000
a(i).MsShape.Width = 1000
a(i).MsShape.Height = 1000
End Sub
控件显示出来了,但是捕捉不到任何事件!急!请帮忙!谢谢!