Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Imagelists

Imagelists

Scheduled Pinned Locked Moved Visual Basic
databasedesignquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rswipe
    wrote on last edited by
    #1

    Hi All, Is it possible to move image files around an ImageList during run time after the ImageList has been populated at design time? Basically i'm looking for the code syntax for being able to sort image files (*.gif) in an ImageList. Can this be done using the "index" value of the stored images? thanks

    D 1 Reply Last reply
    0
    • R rswipe

      Hi All, Is it possible to move image files around an ImageList during run time after the ImageList has been populated at design time? Basically i'm looking for the code syntax for being able to sort image files (*.gif) in an ImageList. Can this be done using the "index" value of the stored images? thanks

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      There isn't any way to sort an existing ImageList. You can Add images to the end of the ImageList and RemoveAt any index in the list, but you can't "AddAt", "Insert", "Move", or "Swap". I can see a possible way to do it, but you'd end up extending the existing ImageList class and supplying the code to InsertAt or Swap. The only way I can see supporting this is making an entirely new ImageList, copying the images from the source ImageList one at a time to a new ImageList and stopping at the appropriate places to make whatever changes are needed. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      R 1 Reply Last reply
      0
      • D Dave Kreskowiak

        There isn't any way to sort an existing ImageList. You can Add images to the end of the ImageList and RemoveAt any index in the list, but you can't "AddAt", "Insert", "Move", or "Swap". I can see a possible way to do it, but you'd end up extending the existing ImageList class and supplying the code to InsertAt or Swap. The only way I can see supporting this is making an entirely new ImageList, copying the images from the source ImageList one at a time to a new ImageList and stopping at the appropriate places to make whatever changes are needed. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        R Offline
        R Offline
        rswipe
        wrote on last edited by
        #3

        Thanks for putting me out of my misery Dave. I also had the idea of generating another imagelist but was trying to do things more compactly if possible. Do you know if there is a way of extracting the index of the image file as an integer and store it as another variable? thanks

        D 1 Reply Last reply
        0
        • R rswipe

          Thanks for putting me out of my misery Dave. I also had the idea of generating another imagelist but was trying to do things more compactly if possible. Do you know if there is a way of extracting the index of the image file as an integer and store it as another variable? thanks

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Are you syaing that you want the .Add() method to return the index that the image was put into? .Add() is a sub and doesn't return a value. Since the new image is always appended to the end of the collection, you can probably use the Items.Count property to find out what the next index is going to be before you .Add() the image. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups