In simple terms you would have the shadow turned off by design and then turn it on & off within the Event procedure for the form's Move event, depending on the latest position of the pointer as reported.
Unfortunately, when I looked in my 2019 version, I found no way to turn shadowing on or off :-(
I also had difficulties making sense of the
Form_MouseMove
documentation on Microsoft's web site. I left a comment to that effect but couldn't get it to work even to change the size of the font :-(
However, I will keep this flagged and attempt to find out more for you. Watch this space.
In the meantime, the basic logic should be something like the following which I knocked up to test :
- Option Compare Database
-
Option Explicit
-
-
Private Const conCB As String = "cmdTest"
-
-
Private Sub Form_MouseMove(Button As Integer, Shift As Integer _
-
, X As Single, Y As Single)
-
Dim lngFS As Long
-
-
With Me
-
With .Controls(conCB)
-
If X < .Left Or X > .Left + .Width _
-
Or Y < .Top Or Y > .Top + .Height Then
-
lngFS = 11
-
Else
-
lngFS = 15
-
End If
-
If .FontSize <> lngFS Then .FontSize = lngFS
-
End With
-
End With
-
End Sub
You can ask questions about this once you've read & tried to understand it.
Here's the basic design of the form. Very simple with a Button control in the middle of an otherwise empty form with a 1cm gap on all sides.
