I’m building control library which contains flat style controls. Elements of my library are highlighted when mouse is over and highlighting is off when mouse is outside of the control. The problem is in turning off the highlight. OnMouseLeave event don’t work properly In my opinion and because of that control is highlighted even when mouse is outside of the control.
I thought that I fix this with IMessageFilter but problem still exist when control is on the corner of Application window. When this situation occurs I still don’t have solution to catch mouse leave event.
Is there any good solution for this problem
Btw. I thought about mouse hook but it is “dirty” solution in my opinion, and I don’t know how hook can affect on performance

How to creat nice flat control without highlight bug ???
Frank Kerrigan
joyce21
If I was doing what you are trying to do, I'd write a simple function using a timer that fired off a pseudo-HITTEST event every couple of seconds after the user has activated your initial highlight. When you get back a value indicating that the cursor is outside the designated rectangle, the control invalidates (or whatever you prefer). Hooking the mouse is feasible, but, not optimal (because the hook must be registered and unregistered).