locked
White background under icon RRS feed

  • Question

  • Guys, I have a really buffling problem.

    Same icon in resource, same code in OnCustomDraw, and once the background isn't white, but is in the color of the selection (pic 1) and second picture (pic 2) shows that the icon has white background.

    The only difference in code is as follows:

    first the one correctly displayed is setup in the following way:

    VERIFY(m_cImageListNormal.Create(64, 64, ILC_COLOR32, 0, 0));
    
    m_wndListCtrl_->SetImageList(&m_cImageListNormal, LVSIL_NORMAL);
    
    ModifyStyle(LVS_TYPEMASK, LVS_REPORT);
    
    m_wndListCtrl_->SetView(LV_VIEW_TILE)



    second which isn't correctly displayed is setup in the following way:

    VERIFY(m_cImageListNormal.Create(20, 20, ILC_COLOR32, 0, 0));
    
    m_ListCtrl.SetImageList(&m_cImageListNormal, LVSIL_SMALL);
    
    ModifyStyle(LVS_TYPEMASK, LVS_REPORT);
    
    SetView(LV_VIEW_DETAILS);


    As can be seen from the picture above the background for the small icon is white,and yet it should be blue. As I've already said the code for painting of those two CListCtrl classes is IDENTICAL and it is implemented in OnCustomDraw.

    Any help really appreciated

    Saturday, May 28, 2016 6:59 PM

Answers

  • I added a call to CListCtrl::SetBkColor(CLR_NONE) when initializing the control in the MFCListView sample that I previously uploaded.  These are the results

    Icon view

    Small Icon view

    List view

    Tile View

    • Marked as answer by smallC795 Sunday, May 29, 2016 9:32 AM
    Saturday, May 28, 2016 8:18 PM

All replies

  • I added a call to CListCtrl::SetBkColor(CLR_NONE) when initializing the control in the MFCListView sample that I previously uploaded.  These are the results

    Icon view

    Small Icon view

    List view

    Tile View

    • Marked as answer by smallC795 Sunday, May 29, 2016 9:32 AM
    Saturday, May 28, 2016 8:18 PM
  • @RLWA32

    To say that you are great isn't enough. Thank you so much for your help. Really really appreciated.

    Wish you a great day, why? Because you are great guy!

    Thank you.

    Sunday, May 29, 2016 9:32 AM
  • Glad to help. :)
    Sunday, May 29, 2016 10:16 AM