Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bitmap Buttons in Dialogs / EnableWindow

58 views
Skip to first unread message

Frank

unread,
Jan 19, 2015, 8:11:39 AM1/19/15
to
Dear people,

I have a bitmap button:

PUSHBUTTON "Upload",IDC_UPLOAD,20,26,86,51,BS_BITMAP

in a dialog resource and set the bitmap
in the code with CButton::SetBitmap.
This works fine.

But when I disable the button with CWnd::EnableWindow,
the whole button becomes dark grey. I recall
having seen a disabled button where the
picture just had a "lighter" version
of the original picture when disabling.

What am I doing wrong?

Geoff

unread,
Jan 19, 2015, 1:35:34 PM1/19/15
to
You must provide your own greyed-out version of your button and
respond to the control messages it will receive.

Windows will gray out non-custom buttons for you but when you decide
to customize your buttons you take on the responsibility for providing
all the versions of that button in all the states it may be required
to display.

This might be helpful:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb775941(v=vs.85).aspx

Joe Newcomer answered this question in 2001 and described some of the
defects of the CButton class. His solution was a smarter CBitmapButton
class you may find helpful.

http://www.codeproject.com/Articles/530/A-Better-Bitmap-Button-Class

David Lowndes

unread,
Jan 19, 2015, 5:04:49 PM1/19/15
to
>But when I disable the button with CWnd::EnableWindow,
>the whole button becomes dark grey. I recall
>having seen a disabled button where the
>picture just had a "lighter" version
>of the original picture when disabling.

Hi Frank,

If you use an icon (BS_ICON) instead of a bitmap, I think you'll find
the result should be better.

Dave
0 new messages