Results 1 to 6 of 6

Thread: Loading Images

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    363
    Hi, I need to dynamically refresh a number of image controls with different images. From a performance standpoint, I should be using something like an imagelist, but MS says that an imagelist is only for ListView, TreeView, TabStrip, and Toolbar controls. So is there something more efficient than loadpicture("i:\Application Components\Workflows\TmEntry.gif") each time a different image is needed? Any way of loading the images just once and keeping them in memory for reuse?

    Thanks in advance.
    Wade

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    Code:
    Dim MyPict As StdPicture
    
    Set MyPict = LoadPictureApp.Path & "\MyBitmap.bmp")
    if MyPict is a global variable then you can just go

    Code:
    Set Picture1.Picture = MyPict
    whenever you like, even if you set picture1.picture = nothing you still have the picture stored in MyPicture

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    you can use an image list for other things

    eg:

    Code:
    Image1.Picture = ImageList1.ListImages(1).Picture
    you compile all your images into a resource file and retrieve them when required.

    Mark
    -------------------

  4. #4
    Junior Member
    Join Date
    Jun 2000
    Location
    Philippines
    Posts
    24

    Lightbulb



    Yes, you can load pictures once by placing them all in an
    imagelist control say, Img1. Then, when accessing the
    pictures in the imagelist control for a Picture Box use this

    Picture1.picture = Img1.ListImages(<IndexOfPicture>).Picture

    where:
    <IndexOfPicture> = is the index number of the image stored in the imagelist control.

    See? no need to use the LoadPicture function. Hope this helps....



  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    363
    Thank you all That'll make life easier.
    Wade

  6. #6
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Resource File

    May be you can add all you image into a Resource File and then just pull each image anytime when you need it.
    Code:
    LoadResPicture(index, format)
    Where index is your image ID under the Res file and Format is the tyoe of data that you will to retrieve from the Res file.



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