Link to home
Start Free TrialLog in
Avatar of Ram072297
Ram072297

asked on

CStatic background color

I have a CStatic derived member in my Dialog. I want to change the background color when my mouse enters the client area of the CStatic and should be restored to the original color when the mouse leaves the static member.
Avatar of gelbert
gelbert

Use function OnMouseMove() to find out when mouse is over your static control then change background color by setting new brush in OnCtlColor ( handler of WM_CTLCOLOR ). Do the same way when mouse leave control then reset brush in OnCtlColor to default
Avatar of Ram072297

ASKER

The OnCtlColor handler is called at the time of the creation of the dialog so the color of the static is getting changed earlier and also the color of all the static members is getting changed. I want the color change for only the static which is under the mouse.
ASKER CERTIFIED SOLUTION
Avatar of Melange
Melange
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial