ti propongo un esempio, che più che altro è un "escamotage"... per provarlo, crea un nuovo Form, e mettici dentro 2 CommandButton e una Shape
poi copia questo codice:
codice:
Private Sub Form_Load()
Shape1.BorderWidth = 2
Shape1.BorderColor = vbRed
Shape1.Visible = False
End Sub
Private Sub Command1_GotFocus()
With Command1
Shape1.Move .Left - 15, .Top - 15, .Width + 45, .Height + 45
Shape1.Visible = True
End With
End Sub
Private Sub Command1_LostFocus()
Shape1.Visible = False
End Sub
Private Sub Command2_GotFocus()
With Command2
Shape1.Move .Left - 15, .Top - 15, .Width + 45, .Height + 45
Shape1.Visible = True
End With
End Sub
Private Sub Command2_LostFocus()
Shape1.Visible = False
End Sub
volendo se i pulsanti sono pochi, può andar bene questo metodo, ma se diventano tanti sarebbe opportuno creare una matrice di controlli, e il tutto sarebbe gestibile in maniera più snella e con codice meno ridondante.
Boolean