Results 1 to 6 of 6

Thread: listview

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Posts
    114
    Does anyone know how I can put a picture(bmp or ico) in the first column of a listview control not in the heading but where the actual data is placed? I am using the report style because I want headers. What I want to do is put a small foler in the first column. Which tells me that this is a folder and not just a regular file. So some rows will have a folder in the first column and some will not.

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I haven't used listview for a while, and i don't have vb on this comp but to listview.listitems(item).Image should be set the key or index you have from a picture in a imagelist that must be connected to the listview.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    you have to add an image list to your form
    set it's properties for the ico you will use
    then set a reference from your listview to the imagelist
    ie.
    'set the list ctrl icon properties
    '
    listview1.Icons = imagelist1
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Posts
    114
    HeSaidJoe,
    How do you add the icon to the first column after you do the listview1.Icons = imagelist1 statement? I did this and see no icon in the listview control. I added one image to the imagelist control.

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    as i said:
    Code:
    listview1.listitems(iteminlistview).Image= iteminimagelist
    the items should be either specified as keys, or index, that depends if you have them with or without keys.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    [code]
    'Sorry, busy day


    'in this example lvwAddresses is the listview
    'ilsSmallIcons and slsLargeIcons are 2 imageboxes
    'one for large one for small icons

    Dim itmAddress as ListItem

    'set the list ctrl icon properties
    'this initializes the image list

    lvwAddresses.Icons = ilsLargeIcons
    lvwAddresses.SmallIcons = ilsSmallIcons
    '
    'add columnHeaders..the width of the columns is
    'the widht of the ctrl / 2 by the num of headers
    '
    Set hdrAddresses = lvwAddresses.ColumnHeaders.Add(, , "Name")


    'add some data to the listitem (itmAddress)
    Set itmAddress = lvwAddresses.ListItems.Add(, , "Kim & Deb", 1, 1)
    itmAddress.SubItems(1) = "944-444-4444"
    itmAddress.SubItems(2) = "44 who knows 44"

    '
    'note
    'to omitt the icons remove the 1,1 form the statement

    Set itmAddress = lvwAddresses.ListItems.Add(, , "Phil & Tony")
    itmAddress.SubItems(1) = "444-055-5555"
    itmAddress.SubItems(2) = "55 who knows 55"

    [code]
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

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