CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    4

    Add Image to subitem

    Is it possible to add icon to a subitem in a Record View of CListCtrl ?


  2. #2
    Join Date
    Apr 1999
    Location
    Bangalore, India
    Posts
    25

    Re: Add Image to subitem

    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


  3. #3
    Join Date
    Apr 1999
    Location
    Bangalore, India
    Posts
    25

    Re: Add Image to subitem

    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).


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured