Wenas a todos, vereis, eske estaba haciendo un juegecillo, donde un shape qe se mueve, y al tocar un label, "label1" (hay 20, index del 0 al 19) te salte un msgbox. Esto lo comprueba un timer con un interval de 1, y no me apetece escribir 20 codes iguales. Sin matriz, el code (para 1 label) sería:
Código:
Pero no tengo mucha idea sobre matrices de controles, y nose qe hay qe poner junto con label1 para qe funcione con todos por igual...
Sabeis como se haría?
Gracias
Código:
Código [Seleccionar]
Private Sub Timer1_Timer()
If Shape1.Top >= Label1.Top And Shape1.Top + Shape1.Height <= Label1.Top + Label1.Height Then
If Shape1.Left >= Label1.Left And Shape1.Left + Shape1.Width <= Label1.Left + Label1.Width Then
MsgBox "OK"
End If
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Shape1.Move X - 495 / 2, Y - 495 / 2
End Sub
Pero no tengo mucha idea sobre matrices de controles, y nose qe hay qe poner junto con label1 para qe funcione con todos por igual...
Sabeis como se haría?
Gracias