Am 09.05.2012 10:37, schrieb scbs29:
> does anyone know of a free control or whatever to display
> png images on a form in vb6 ?
The vbRichClient4-Framework (consisting of 3 free
Dlls) can do that for you, in a very reliable way
(no memory-leakage, no GDI-resource-Handles are
used, etc.).
And since there's no UserControl necessity involved
(the Png-Loading and rendering can finally be done directly
against a Form.hDC - also for multiple Png-Images,
overlayed with each other, including Alpha-transparencies
and what not) - you can code all your stuff more
or less completely "windowless" (no Extra-Hwnds or
other GDI-Handles as e.g. DIB-Handles need to be used).
www.datenhaus.de/Downloads/vbRC4BaseDlls.zip
(about 2MB, please keep the 3 Dlls always together in a
Folder - only vbRichClient4.dll needs to be registered)
Here are some Demos for this cairo-based Mini-framework:
An extensive cairo-Tutorial (organized in 24 SubFolders):
www.datenhaus.de/Downloads/RC4cairoTutorial.zip
Maybe take a look at Demo #8, as well as Demos #12
and #15, to see how to deal with different Image-Shapes.
And a small Widget-Demo, incorporating not only a new
Usercontrol-Engine for VB6 but also a new Unicode-FormEngine
(no
VB-*.frm or *.ctl are needed, only *.bas and *.cls)
www.datenhaus.de/Downloads/RC4WidgetDemo.zip
As for your "Out of Memory-Errors" - these can (as said)
also happen, when the Application runs out of GDI-Handles.
But at least *that* cause is completely "out of the game"
when using the RichClient4-Dlls.
But a loaded Png-Image-Resource will need "normal Memory"
of course (Widht x Height x 4Byte per Image) ... so in
case you want to keep "hundreds" of relatively large
Png-Images "cached" in your Application - this could in sum
amount to about 100MB or more - not sure if that is the case,
or what the amount of RAM was on your "Notebook in question".
Just ask here, if you find that approach basically
interesting (but get stuck somewhere, whilst adapting
some of the Demos VBCode to your needs) - I'm sure
I can help in this case, especially when you already
post some Code-Snippets which demonstrate or describe
a possible problem.
Olaf