c++ - How to create a simple MFC uniform color HICON icon by code? -
c++ - How to create a simple MFC uniform color HICON icon by code? -
this simple: have application uses clistctr in study mode , want assign icons entries. icons should simple square uniformly coloured icons 16x16.
i know ( - i think know - ) how handle clistctr
, cimagelist
, challenge have following:
essentially, want 'abuse' images kind of status-light in clistctr arbitrary colour.
can give me short illustration code snipped for:
creating hicon
element 16x16 uniformly filled bitmap of colorref
specified colour?
try this:
cdc dc; dc.createcompatibledc(null); m_bitmap.createbitmap(16, 16, dc.getdevicecaps(planes), dc.getdevicecaps(bitspixel), null); m_imagelist.create(16, 16, ilc_colorddb, 0, 1); hgdiobj hold = dc.selectobject(m_bitmap); dc.fillsolidrect(0, 0, 16, 16, rgb(0xff, 0, 0)); dc.selectobject(hold); m_imagelist.add(&m_bitmap, rgb(0, 0, 0)); m_listctrl.setimagelist(&m_imagelist, lvsil_small); m_listctrl.insertitem(0, _t("hello"), 0);
c++ mfc icons control
Comments
Post a Comment