CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Adding Icon to Listview

  1. #1
    Join Date
    Mar 2003

    Adding Icon to Listview

    Hello ,

    hello I need to set a different PNG image (with transparency ) from file for every item I add in a listview

    I tried to add the items as follows


    but it provides imageindex rather than Icon or Image as param... ()

    Since, I have my image for each item on disk.. so I was hoping to add the items in the list by creating listviewitem and then adding image to it and then adding this to listview..

    ListViewItem lvItem = new ListViewItem()

    // set lvitem's name etc

    //load my image from file

    myImage = new Bitmap(@"image path here");

    // but ImageList is null at this point ??? I dont understand whats going on..


    Please help, this might be a very basic thing but I havent worked on C# before


    Last edited by xs2ahmed; August 15th, 2009 at 09:01 PM.
    He is not strong and powerful, who throws people down, but he is strong who withholds himself from anger

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004

    Re: Adding Icon to Listview

    This isn't exact, but close. Check out http://social.msdn.microsoft.com/For...f-caebf3b1c10f

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)