- Local time
- Today, 09:41
- Joined
- Feb 19, 2013
- Messages
- 17,414
You can use the mousemove event to detect whether the mouse is over a specific control, but you can't tell when it is no longer over the control without using a mousemove or other event such as click from another control or perhaps the section background. But move the mouse quick enough and that event may not fire.
you could perhaps use conditional formatting but that can be problematic again when the mouse is no longer over the control.
Buttons have a hover property and the attached db demonstrates how this effect can be applied to controls on a continuous and single form. Note this does not work for a datasheet view. Neither do buttons
The principle is to set the backcolor (or could be the border, forecolor, font size or any appropriate control property) on the mousemove event and to restore it in a form timer event. This solves the issue of needing two (or more) other control events and eliminates the risk of the 'restore' event not firing
There are three forms, the code in all is identical. The code uses API's and these can be farmed out to a standard module, but I chose to have them in the form module since others may have the same or similar API's in their own apps.
There are two versions of the continuous form the first is a 'standard' look, the second with a taller detail section. Both highlight the control in all records,
you could perhaps use conditional formatting but that can be problematic again when the mouse is no longer over the control.
Buttons have a hover property and the attached db demonstrates how this effect can be applied to controls on a continuous and single form. Note this does not work for a datasheet view. Neither do buttons

The principle is to set the backcolor (or could be the border, forecolor, font size or any appropriate control property) on the mousemove event and to restore it in a form timer event. This solves the issue of needing two (or more) other control events and eliminates the risk of the 'restore' event not firing
There are three forms, the code in all is identical. The code uses API's and these can be farmed out to a standard module, but I chose to have them in the form module since others may have the same or similar API's in their own apps.
There are two versions of the continuous form the first is a 'standard' look, the second with a taller detail section. Both highlight the control in all records,