Marcus Hand
March 31st, 1999, 10:16 AM
In a list control, can a subitem contain an image. I can't seem to get this to work. If possible, I don't understand
why following code doesn't work:
//m_icons is CImageList
m_icons.Create( 16, 16, ILC_COLOR, 5, 5 );
m_icons.Add( AfxGetApp()->LoadIcon( IDI_ICON1 ) );
m_icons.Add( AfxGetApp()->LoadIcon( IDI_ICON2 ) );
m_listCtrl.SetImageList( &m_icons, LVSIL_SMALL );
m_listCtrl.InsertColumn( 0, "Name", LVCFMT_CENTER, 50, 0 );
m_listCtrl.InsertColumn( 1, "Description", LVCFMT_LEFT, 100, 1 );
m_listCtrl.InsertItem( 0, "Marcus", 0 );
m_listCtrl.SetItem( 0, 1, LVIF_IMAGE, NULL, 0, 0, 0, 0 );
why following code doesn't work:
//m_icons is CImageList
m_icons.Create( 16, 16, ILC_COLOR, 5, 5 );
m_icons.Add( AfxGetApp()->LoadIcon( IDI_ICON1 ) );
m_icons.Add( AfxGetApp()->LoadIcon( IDI_ICON2 ) );
m_listCtrl.SetImageList( &m_icons, LVSIL_SMALL );
m_listCtrl.InsertColumn( 0, "Name", LVCFMT_CENTER, 50, 0 );
m_listCtrl.InsertColumn( 1, "Description", LVCFMT_LEFT, 100, 1 );
m_listCtrl.InsertItem( 0, "Marcus", 0 );
m_listCtrl.SetItem( 0, 1, LVIF_IMAGE, NULL, 0, 0, 0, 0 );