Click to See Complete Forum and Search --> : Add Image to subitem


comx
April 14th, 1999, 04:17 AM
Is it possible to add icon to a subitem in a Record View of CListCtrl ?

Vicky
April 23rd, 1999, 05:52 AM
It is possible to add icons to the subitems of a CListCtrl. There are two new fields in the LV_COLUMN struct - iImage being one of them. I have not used this method but you can try it and you do not need to create owner-drawn control.
If you have a CListCtrl in a view other than CListView (say CFormView), you can override OnDrawItem(WM_DRAWITEM) and draw your control items and subitems.
If you have derived the view from CListView, you can override DrawItem.

Hope this solves your problem

Vicky
April 27th, 1999, 08:57 AM
Use the extended ListView style LVS_EX_SUBITEM_IMAGES. Create the CListCtrl and change style using the macro ListView_SetExtendedListViewStyle(m_listctrl.m_hWnd, LVS_EX_SUBITEMIMAGES). Use LVCOLUMN (superset of LV_COLUMN) to set the icons to the subitems.
Help is available in MSDN library( Jan 1997 and later).