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:

the icon colour created code , arbitrary colorref the icons not created files in resources should created code also. if need be, there can 1 'template' icon in specific color replaced colorref above.

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

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -