Win32 - BS_BITMAP button bitmap disappears when disabled?

Started by
4 comments, last by InsaneBoarder234 18 years, 8 months ago
I'm using C++/Win32 API to create a window and controls for my program and I'm using buttons with the BS_BITMAP style. After a quick google search I got them working great until I tried disabling the buttons. Now the idea I had in my head was that I would have to set a new disabled button image whenever the buttons are disabled - So basically send the BM_SETIMAGE message again with the disabled button image. But whenever I disable the buttons they turn into ugly grey rectangles, whether or not I send a BM_SETIMAGE message to change the button image. Heres a screenshot to show what I mean. The left-most and right-most buttons are enabled and show their images fine but the middle three buttons are disabled and show an ugly grey rectangle. I've searched google for information on this and all I could find were two forum posts where people had suggested things that didn't work and then the post just died. Surely someone knows how to make a Win32 API button where the disabled image actually works! Cheers! :)
Progress is born from the opportunity to make mistakes.

My prize winning Connect 4 AI looks one move ahead, can you beat it? @nickstadb
Advertisement
Sorry I'm at work and cannot answer the OP question fully at the moment. My recollection is that if want to get bitmap buttons drawn properly when disabled you have to resort to owner drawn buttons but I could be mistaken.

Probably the easiest solution is to make your button images icons with transparency and use BS_ICON instead.
---CyberbrineDreamsSuspected implementation of the Windows idle loop: void idle_loop() { *((char*)rand()) = 0; }
Thanks for the reply.

Can anyone point me to some tutorials on creating owner drawn buttons?
Progress is born from the opportunity to make mistakes.

My prize winning Connect 4 AI looks one move ahead, can you beat it? @nickstadb
Using Owner Draw Buttons
if you use a toolbar control to display the buttons, the toolbar control will take care of "disabling" the button image for you, or you can provide your own disabled image via an image list.
Thanks for the replies. I just had a look at the tutorial on owner drawn buttons and I'm going to go that route :)
Progress is born from the opportunity to make mistakes.

My prize winning Connect 4 AI looks one move ahead, can you beat it? @nickstadb

This topic is closed to new replies.

Advertisement