MSFlexGrid Limitations?

My app uses the MSFlexGrid control into which a number of thumbnails are loaded. Each of these thumbnails is 24-bit and around 14k in size.

Prior to being loaded into the FlexGrid, the thumbs are loaded into an ImageList control. This is because the user can drag and drop within the MSFlexGrid to re-arrange the order of the thumbs (saves me from reading the .bmps back in from the HD).

I have an error handler that displays an 'Out Of Memory' .bmp which is displayed in the MSFlexGrid when appropriate instead of the thumbnail. This is stored only once in the ImageList.

My old PC (an AMDK6 233Mhx PII, 32MB RAM) would load about 350 thumbnails
before it began to use the 'Out of Memory' .bmp.

Last week I took delivery of a new PIII 600Mhz machine with 128MB RAM and the same thing happens, i.e. c350 thumbs succesfully loaded before 'Out of Memory' .bmp kicks in.

The question is, what is governing the amount of thumbs I can succesfully load into the FlexGrid? It doesn't appear to be related to the spec of my machine.
LVL 3
TheRedGuyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TheRedGuyAuthor Commented:
Oh, btw, I tried downgrading all of the thumbs to 8-bit and the problem doesn't go away......
0
amebaCommented:
>what is governing the amount of thumbs I can succesfully load
GDI memory, which is limited by OS (except on NT 4.0 or better)
0
amebaCommented:
Also, ImageList can hold only 255 pictures.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

TheRedGuyAuthor Commented:
ameba,

Interesting comments.

Could you please expand a bit on the GDI comment (pretty ignorant about such things).

Also, let us assume I am mistaken when I say that I have successfully loaded around 350 .bmps into the FlexGrid and that, therefore, my problem is due to the ImageList 255 images limitation. What might I use instead to serve the same purpose?

Thanks for your input whether you can or can't continue to assist....
0
amebaCommented:
http://www.ascensionlabs.com/pbt_windowsresources.htm

You can check memory (GDI & User) usage from VB: menu Help, About, System Information

More than 255 different pictures loaded ... maybe you can change UI, e.g. directly paint pictures onto the user control or to picturebox.
0
TheRedGuyAuthor Commented:
ameba,

thanks, but I know that I can check the amount of GDI and User memory. What I don't know in simple terms) is what these things mean or how they might impact my app in the context of my problem.

re your second point. I could paint straight onto the flex grid but I would have to re-code a lot of stuff to facilitate the (fast) dragging and dropping referred to in the question. At the moment, an array acts as the interface between the FlexGrid and the ImageList and I can quickly re-arrange the Grid without any further HD access.

Any more ideas? Or possibly my initial approach is not the best? I have to admit that the present design exists more through evolution of the app than up-front design. Not uncommon methinks :)
0
tirupur_selvaCommented:
Hi,
  If you could explain the exact syntax of how you add the image to your flexgrid and approximate number of distinct images you would need to load, I can provide you the solution. I have faced the same problem and have come out of it.
0
mcriderCommented:
ameba,

According to the help pages for the imagelist control:

"You are not limited to any particular image size, but the total number of images that can be loaded is limited by the amount of available memory."

There is no mention of a 255 picture limitation...


Cheers!
0
amebaCommented:
Ah, yes, tested few minutes ago and got 366 icons, than memory error.
0
mcriderCommented:
TheRedGuy,

Do all the images have to be displayed at the same time, or can you page and swap your images...  For example, Lets say your grid will show 100 pictures and you have a two other imagelists... A "Head" imagelist and a "Tail" imagelist.  Basically, the these two imagelists would work this way:

when you start the program the "Head" is empty, and you populate the grid with 100 images show them, and populate the "Tail" with the next 100 images, basically preloading a read cache.

when you page down in the grid, the 100 images get moved to the "Head" and the "Tail" images get moved to the grid, and you read the next 100 images into the "Tail" for the next display...

Get the idea?


Cheers!
0
amebaCommented:
Just tested vbAccelerator Image List Control with over 1000 images, no memory problem.
I didn't test it with MSFlexGrid, but you can try.
Control comes with source (VB).
http://vbaccelerator.com/overcomc.htm
0
amebaCommented:
>didn't test it with MSFlexGrid
It works with listview and treeview only.
And with all vbAccelerator controls, e.g. SGrid
0
GustavoValdesCommented:
Why don't you just create an array of picture boxes and load every picture you have in the corresponding control, in the process, use the .Tag propery to store information about the relative position of every picture.

Another thing you should consider very seriously is to convert all the pictures to a lighter format like .jpg or .gif, this way the amount of memory used to load the pictures will me much less.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tirupur_selvaCommented:
At the runtime, load the pictures to an imagelist using the loadpicture().  

    Dim img As ListImage
    Set img = imgImages.ListImages.Add(1, "Ticked", LoadPicture(App.Path & "\TickedBox.Bmp"))
    Set img = imgImages.ListImages.Add(2, "Crossed", LoadPicture(App.Path & "\Crossed.Bmp"))
..
..
..
..
Then while assigning to the msflexgrid cell, use
Set MSFlexgrid.CellPicture = imgImages.ListImages(1).Picture
...like wise, you can use any number of images in a grid.
Hope this would be useful
Regs
Selva
0
TheRedGuyAuthor Commented:
tirupa_selva,
am rejecting your answer as what you propose is (pretty much) what I am currently doing. Or am I missing something in your answer?

GustavoValdes,
I may end up going down that route if nothing better turns up here.....

re .jpg/.gif: These are compressed and there is an overhead in performance associated with decompressing them for display. Also, in my question I mention that at 8-bit the limitation problem does not go away (the thumbs are around 5K at 8-bit as opposed to 14K at 24-bit)

mcrider,

all of the images need to be displayed at the same time because somebody might drag thumbnail from position No.1 and drop it at position 1000. I could swap out in the way you suggest during the drag and drop operation but I think it would behave horribly! Thanks anyway.
0
mcriderCommented:
Never can tell, until you ask, huh... Good-Luck!


Cheers!
0
TheRedGuyAuthor Commented:
GustavoValdes,

I am prepared to give you 100 points if nobody else can help. I now the original offer was 200 but what you suggested was an option that I had in mind prior to posting and doens't really answer the question as such...that OK?

Everyone else,

Going Once......
0
TheRedGuyAuthor Commented:
Going Twice....
0
GustavoValdesCommented:
Of course I'm Ok, unfortunately we couldn't give a better solution or at least one that really fullfill your needs.
 
Regards,
0
TheRedGuyAuthor Commented:
Last chance and then its GustavoValdes....
0
TheRedGuyAuthor Commented:
It's yours GustoValdes..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.