Usa Timer/Dibuja bordes/Cambia el Backcolor
El control se pinta solo al recibir el foco....
Pero si quieres ponerle un marco o cambiar el color de fondo cuando reciba el foco, y no quieres hacerlo en el evento _GOTFOCUS de cada control, entonces puedes usar algo como esto...
En tu formulario, aparte de los controles que tengas, agrega un Timer (Timer1) ...
Ojo:
Algunos controles como el CommandButton no reflejan el color de fondo que le pongas a menos que les cambies su estilo a Grafico....
Si los controles los agrupas dentro de un Frame (como los OptionButton por ejemplo), el Frame no admite el metodo .Line por lo que no aparecera el marco dibujado alrededor de dichos controles ...
''''''
Private Sub Form_Load()
Me.Timer1.Interval = 100
Me.Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Static nX As Single, nY As Single, nX2 As Single, nY2 As Single
Static sName As String, sIndex As String
Static oContainer As Control
Static oControl As Control, nColor As Long
Dim sNewName As String, sNewIndex As String
If Me.ActiveControl Is Nothing Then Exit Sub
sNewName = Me.ActiveControl.Name
On Error Resume Next
sNewIndex = Me.ActiveControl.Index
On Error GoTo 0
If sNewName = sName And sNewIndex = sIndex Then
Exit Sub
End If
Me.DrawMode = vbCopyPen
Me.DrawWidth = 2
If Trim(sName) <> "" Then
If oContainer Is Nothing Then
Me.Line (nX, nY)-(nX2, nY2), Me.BackColor, B
Else
On Error Resume Next
oContainer.Line (nX, nY)-(nX2, nY2), oContainer.BackColor, B
On Error GoTo 0
End If
oControl.BackColor = nColor
End If
Set oControl = Me.ActiveControl
nColor = oControl.BackColor
sName = sNewName
sIndex = sNewIndex
nX = oControl.Left
nY = oControl.Top
nX2 = oControl.Left + oControl.Width
nY2 = oControl.Top + oControl.Height
If oControl.Container.Name = Me.Name Then
Set oContainer = Nothing
Else
Set oContainer = Me.Controls(oControl.Container.Name)
End If
If oContainer Is Nothing Then
Me.Line (nX, nY)-(nX2, nY2), vbRed, B
Else
On Error Resume Next
oContainer.Line (nX, nY)-(nX2, nY2), vbRed, B
On Error GoTo 0
End If
oControl.BackColor = vbYellow
End Sub