Page 1 of 3 123 LastLast
Results 1 to 15 of 34
  1. #1
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Image List Control (A2k)

    With the treeview sample attached, is it possible to assign a different image than the one in the child
    branches, to one of the users choice ?
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Image List Control (A2k)

    All images used must be items in the ImageList control. You can let the user add items to the ImageList in runtime. See ImageList Control Example.

    You would then have to make the code that populates the tree view flexible. Probably the best way is to include two extra fields in the Objects table: Image and SelectedImage; both are numeric (Integer) and represent the index of the image for the image to be used in the ImageList. Adding a node would look like this:

    TreeCtrl.Nodes.Add , , rs!object_name, rs!Description, rs!Image, rs!SelectedImage

  3. #3
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image List Control (A2k)

    Thanks Hans
    I came across the example and thought the code involved looked quite user friendly.
    The icons just looked a little naff though.
    The link looks very interesting, I'll have a play with it later.

  4. #4
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image List Control (A2k)

    Hans
    I'm struggling to register the Common Dialog control, No license, any tips or idea's.

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Image List Control (A2k)

    You can use the open dialog code that employs Windows API calls instead of the common dialog control. I believe you posted an example yourself last week <img src=/S/evilgrin.gif border=0 alt=evilgrin width=15 height=15>

  6. #6
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image List Control (A2k)

    Hans
    I was wondering why I couldn't register it <img src=/S/confused.gif border=0 alt=confused width=15 height=20> , I've always used the API call.
    Have a good day.

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Image List Control (A2k)

    Do you have Office 2000 developer or VB Pro? If so, you have a license for the common dialog. Otherwise, not.
    Charlotte

  8. #8
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image List Control (A2k)

    I'm afraid not Charlotte. I do have VB6 which is not installed since I changed my PC some time ago, but for now, I can work with the API.

    Thanks all the same.

  9. #9
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image List Control (A2k)

    Hans
    Now I have this working, what file extension is the best to use.

    .ico
    .jpg
    .bmp

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Image List Control (A2k)

    In itself, it doesn't matter much; file sizes will be small. But you should get 16 by 16 pixel images; I guess that icons (.ico) of that size are easiest to find.

  11. #11
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image List Control (A2k)

    Hans
    I found the answer as you were posting, .ico seems to work very well.
    Kind of neat this is !!
    I can see some good uses for the TreeView <img src=/S/compute.gif border=0 alt=compute width=40 height=20>

  12. #12
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image List Control (A2k)

    How should the code in the ImageList Control Example be changed if you wanted to use FileDialog instead of CommonDialog?

  13. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Image List Control (A2k)

    More or less like this:

    ...
    Dim i As Integer
    Dim tempName As String
    With Application.FileDialog(msoFileDialogFilePicker)
    .Filters.Clear
    .Filters.Add "Icons", "*.ico"
    .AllowMultiSelect = True
    If .Show = True Then
    For i = 1 To .SelectedItems.Count
    tempName = .SelectedItems(i)
    Me.ImageList1.ListImages.Add , tempName, _
    LoadPicture(tempName)
    Next i
    End If
    End With
    ...

  14. #14
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image List Control (A2k)

    Thank you Hans, how can you list the images contained in an ImageList Control?

  15. #15
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Image List Control (A2k)

    I think I've found out how to list the ImageList Control images:
    Dim i As Integer
    For i = 1 To ImageList1.ListImages.Count
    debug.print ImageList1.ListImages(i).Key
    Next i

Page 1 of 3 123 LastLast

Posting Permissions

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