|
-
May 12th, 2003, 04:42 PM
#1
Thread Starter
New Member
Out of Memory - Picture Boxes at run time
I have a control array of Picture Boxes with 900 elements in it on one form. They are distributed over 6 frames on that form and only one frame will be visible at a time.
Now I have about 12 .gif files about 124K - 150K in size.
Each of these picture boxes needs to be loaded with one of the 12 images depending on the program logic durign run time. The Picture in the picture box can be changed at during rumtime say when a user clicks a certain button.
The Problem: The following code displays the error message out of memory
Private Sub Form_Load
Dim i As Integer
For i = Picture1.LBound to Picture1.UBound
Picture1(i).Picture = LoadPicture ("image07.gif")
Next i
End Sub
This displays an Error message "Out of memory"
However, if I replace the Picture1.UBound with 1400, it works - i.e, basically it has a problem loading all the images.
How to do this:
It would be really cool if I could use pointers of some kind. I could just load the 12 images I need and point each picture box to the address of the image in the memory or soemthing. Basically, to avoide to keeping copies of the same image in memory?
Is there any way I can do this.
It would super cool if I can do something like this:
Set Picture(1002).Picture = Picture(1003).Picture
Any ideas!!? esperate, please help
-
May 12th, 2003, 05:13 PM
#2
Excuse me for starting my reply with this but: Why the heck would you ever need 900 picture boxes on one form????????
You can assign one picture box to another this way:
VB Code:
Picture1(1).Picture = Picture1(0).Picture
assuming Picture1(0) already has a picture loaded in it.
-
May 12th, 2003, 06:31 PM
#3
You can also use the StdPicture object. Load your 12 pictures into these objects and draw them to the picture boxes as needed.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|