Hey everyone, I am working on a win32 project right now and I have a few buttons that I wanted to change how they look so I gave them the BS_OWNERDRAW property and drew them myself. Now sense I am using ownerdraw there is no visual indication of when someoone hovers over the button and/or clicks it. So I want to make the button turn slightly transparent when someone hovers over it. Does anyone know what I should do to achieve this?


Recommended Answers

All 3 Replies

Just off the top of my head, I would say to capture the WM_MOUSEMOVE message for the particular buttons and then set the alpha as you wish.

You might find some interesting suggestions here at CodeProject, the world's largest repositary of free MS-Windows programs and tutorials on the net.

Since you're starting with a standard button and modifying it, you should have access to the MouseEnter event. Put your code to change the button in there. Setting the TransparencyMask of the Bitmap Should help in what you want.

One alternative to the button is the label. By changing the border in the Click event you can give an indication of clicking and the backcolor supports Colors.Transparent.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.