Results 1 to 3 of 3

Thread: Imagelist for Listview

  1. #1

    Thread Starter
    Addicted Member morphman2000's Avatar
    Join Date
    Oct 2000
    Location
    Europe, The Netherlands
    Posts
    254

    Imagelist for Listview

    I am creating a Listview and I want to assign an Image list to my ListView so I can use images in my Items. Next is a peace of my code:

    Code:
      lngImageList = ImageList_Create(32, 32, ILC_MASK, 1, 1)
      
      ImageList_Add lngImageList, LoadResPicture(102, 1).Handle, 0
    
      lngStyle = WS_CHILD Or WS_VISIBLE Or LVS_REPORT
      m_hWndLV = CreateWindowEx(WS_EX_CLIENTEDGE, "SysListView32", vbNullString, _
        lngStyle, 10, 10, 300, 200, Me.hwnd, 0, App.hInstance, ByVal 0&)
        
      lngtest = SendMessage(m_hWndLV, LVM_SETIMAGELIST, LVSIL_SMALL, lngImageList)
    Problem is that 'lngtest' returns a 0-handle (value 0). So when I am adding Items with Images, the Images won't appear, because of this bug.

    Does someone has any idea what I did wrong in assigning the imagelist to my listview?

    Tnx.

  2. #2
    grantfrench
    Guest
    Why dont you just use the Imagelist Control from the microsoft common controls then assign the imagelist using the Icons property in the listview control?

    Create a imagelist called imglst1
    Create a listview called lstview1

    example code:
    lstview1.icons = imglst1


    Now isnt that a hell of a lot simpler?

    I knew why you where doing it using api as soon as i looked at your signature, VC gave it away.


    Grant French
    [email protected]

  3. #3

    Thread Starter
    Addicted Member morphman2000's Avatar
    Join Date
    Oct 2000
    Location
    Europe, The Netherlands
    Posts
    254
    Well, it is a lot simpeler, but just for fun and education I wanted to create my own listview + my own imagelist in API. Also because I wanted to add some functions which can't be done with the common dialog control but only can be done by API.

    That's why... k?!

    but since the time you were posting the previous message, my own listviewcontrol were already done.... !
    Last edited by morphman2000; Jun 24th, 2001 at 04:36 PM.

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