Results 1 to 10 of 10

Thread: loading image instead of text in listview - C# *resolved*

  1. #1

    Thread Starter
    Hyperactive Member Colonel Klink's Avatar
    Join Date
    Aug 2002
    Location
    Gold Coast, Australia
    Posts
    329

    loading image instead of text in listview - C# *resolved*

    im wanting to load an image (thats 50x50), instead of a string, into a listview column (not the header)

    not ness. the first column, but any.

    ive tried using Bitmap.FromFile, but i get an error (cant convert the image to a string)

    how, if possible, would one accomplish this?
    Last edited by Colonel Klink; Sep 8th, 2003 at 10:33 PM.

  2. #2
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    i think it will be very very hard as the listview doesnt allow each item to be drawn by itself as the combobox/listbox allow..so only maybe with a lot of subclassing
    \m/\m/

  3. #3

    Thread Starter
    Hyperactive Member Colonel Klink's Avatar
    Join Date
    Aug 2002
    Location
    Gold Coast, Australia
    Posts
    329
    damn

    how about a listbox then?

  4. #4
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    could u explain what u really wanna do plz so it might be easier to help?
    \m/\m/

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    You mean loading an image in the item collection of the listview as in the attachment ?
    Attached Images Attached Images  

  6. #6

    Thread Starter
    Hyperactive Member Colonel Klink's Avatar
    Join Date
    Aug 2002
    Location
    Gold Coast, Australia
    Posts
    329
    thats the one Pirate

    except an image thats 50x50 or 100x100

    how would i do this?


    btw... its also gotta have text with it in other columns
    Last edited by Colonel Klink; Sep 8th, 2003 at 03:24 PM.

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Easy . Add your images to ImageList , set Width and Height to whatever (50X50 or 100X100) . Bind it to the listview(3 steps I believe) StateImageList , SmallImageList and LargeImageList all = the imageList control. Add items , from there you can set imageindex to be shown in the listview .

  8. #8
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    In the items collection of the listview, add set Text property to each item in the collection . I've not tried that but it sounds obvious .

  9. #9

    Thread Starter
    Hyperactive Member Colonel Klink's Avatar
    Join Date
    Aug 2002
    Location
    Gold Coast, Australia
    Posts
    329
    oh ok... i was under the impression that i would need to do some subclassing to do an image other than 16x16 or whatever... thanks

  10. #10
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I think PT Exorcist meant combobox or listbox subclassing to hold these images . Right PT Exorcist ?

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