-
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.
-
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
-
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.
-
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....
-
Thank you all ;) That'll make life easier.
-
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.