Results 1 to 10 of 10

Thread: [RESOLVED] Images in a list

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    203

    Resolved [RESOLVED] Images in a list

    How can an image be added to a list?

    I am using a listbox to display the directory of a remote computer using ftp. I am able to determine which files are subdirectories and which ones aren't by the "/" at the end of the file name. I would like to place an image of a folder beside each name in the list that designates a directory or subdirectory. I am not aware of any way to add an image to a listbox or of a control that does allow for a list of images and text combined.

    Is there a method to add an image to a listbox or a control that will allow a list of text and images?

    Thanks

  2. #2
    Fanatic Member bgmacaw's Avatar
    Join Date
    Mar 2007
    Location
    Atlanta, GA USA
    Posts
    524

    Re: Images in a list

    While there are some ways to do this with a standard Listbox you will find it much easier to use the Treeview or Listview controls for this purpose.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    203

    Re: Images in a list

    I have never used either of those controls before. I loaded them, added them to a form to play with them to understand them and like many of microsofts newer controls there isn't much documentation for them, not on using them anyway. As with some of the others I feel sure that in time on this board and others I will get them figured out one day.

    Any helpful hints would sure be appreciated. As of now I am trying to understand how to add items to the list, both pictures and text.

    Thanks again for the help.

  4. #4
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Images in a list

    http://www.google.com/search?client=...utf-8&oe=utf-8

    http://www.google.com/search?hl=en&s...al&btnG=Search

    Google is your friend.
    Read the first few tutorials and ask us if you have any question.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    203

    Re: Images in a list

    Both of those controls are nice, either would work but not exactly what I am looking for. Cute FTP uses what appears to be a standard list with folder icons added to it. This is what I am looking for to use in this current project. Using listview would make a nice FTP program, especially if files and folders could be dragged and dropped to and from a remote location. This would work best with plenty of screen space to use. I am adding some FTP functions to some existing software and do not have that much real estate to use for the ftp functions so it is starting to appear that a standard list box will be needed.

    How can icons be added to a standard listbox?

  6. #6
    Fanatic Member bgmacaw's Avatar
    Join Date
    Mar 2007
    Location
    Atlanta, GA USA
    Posts
    524

    Re: Images in a list

    Quote Originally Posted by sneakers
    How can icons be added to a standard listbox?
    In VB6 it requires subclassing and owner drawing the control. It is complex code, often requiring a subclassing control, that is more trouble than it is worth in terms of development time and complexity plus it makes the final product less stable. I don't recommend doing this unless you're coding for your own enjoyment. You should be able to find some examples at some of the source code repository sites, like CodeGuru or Planet Source Code, but you will find that you need to modify them a lot.

    I still think your best bet is to use Treeview if you need a small footprint, listbox like, widget. It's really not that hard to use and it's rather flexible.

    There were some third party products around in the late 90's/early 00's that provided extended listbox functionality as well. I don't know what the current availability of these would be though.

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    203

    Re: Images in a list

    Listview would work nice if I could set it to look like a standard list with icons. I noticed a setting to make it look like a standard listbox but the icons seem to disappear when I do this. I seem to only be able to use icons when listview looks like the right side of Windows Explorer. Perhaps I am doing something wrong.

    Is there a way to set listview to look like a standard list and show icons?

  8. #8
    Fanatic Member bgmacaw's Avatar
    Join Date
    Mar 2007
    Location
    Atlanta, GA USA
    Posts
    524

    Re: Images in a list

    Here's a quick example done with Treeview. It reads the root directory folders and puts them on the list. See if this is what you're looking for.
    Attached Files Attached Files

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    203

    Re: Images in a list

    I think ListView will work. I must have done something wrong earlier. If I set ListView1.View to lvwList it seems to work fine. I can add a folder beside all directories and no icon beside all of the others. This is exactly what I want. Perhaps in the future I might even add more icons to use for text files, image files etc.

    All I need now is to figure out how to make all of the files line up in a single list on the left side.

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    203

    Re: Images in a list

    Listview works great for this.

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