CButton Load HBITMAP and hide normal button background

95 Views Asked by At

I have a CButton object. I added a bitmap file to the resource editor. I do the following:

CButton m_btnClose; (in header file)

if (GetDlgItem(IDC_BUTTON_CLOSE))
{
    HBITMAP hBMP = LoadBitmapW(AfxGetResourceHandle(), MAKEINTRESOURCE(IDC_BITMAP_CLOSE));
    m_btnClose.ModifyStyle(0, BS_BITMAP);
    m_btnClose.SetBitmap(hBMP);
}

The bitmap is actually loaded and applied to the button, but you can clearly see the regular button background behind it. Ignore the fact the button background is not the same color as the surrounding area.

enter image description here

0

There are 0 best solutions below