Discussion:
Displlay png in VB6 ?
(too old to reply)
scbs29
2012-05-09 08:37:39 UTC
Permalink
Hello all
does anyone know of a free control or whatever to display png images
on a form in vb6 ?
Up until now I have been using a control aicAlphaImage.ocx, but now I
have changed the programs to display the forms fullscreen and the
controls are also enlarged, I get Runtime error 7 out of memory errors
on my wifes laptop which is where the programs are to be run. They run
ok on my desktop. Possibly this control is too 'heavyweight' for the
laptop and I need a lightweight control to just display the pngs.
From searching I gather that this error may not actually mean out of
memory but can have other causes.
Failing this, can anyone suggest where I might start looking with a
view to writing my own control ?
I would prefer to stick with displaying png images if possible, but if
necessary I will have to change to displaying jpgs.
TIA

remove fred before emailing
Registered Linux User 490858
Schmidt
2012-05-09 12:55:38 UTC
Permalink
Post by 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
Mayayana
2012-05-12 03:56:54 UTC
Permalink
http://www.jsware.net/jsware/vbcode.php5#pngops
--
--
"scbs29" <***@fred.talktalk.net> wrote in message news:***@4ax.com...
| Hello all
| does anyone know of a free control or whatever to display png images
| on a form in vb6 ?
| Up until now I have been using a control aicAlphaImage.ocx, but now I
| have changed the programs to display the forms fullscreen and the
| controls are also enlarged, I get Runtime error 7 out of memory errors
| on my wifes laptop which is where the programs are to be run. They run
| ok on my desktop. Possibly this control is too 'heavyweight' for the
| laptop and I need a lightweight control to just display the pngs.
| From searching I gather that this error may not actually mean out of
| memory but can have other causes.
| Failing this, can anyone suggest where I might start looking with a
| view to writing my own control ?
| I would prefer to stick with displaying png images if possible, but if
| necessary I will have to change to displaying jpgs.
| TIA
|
| remove fred before emailing
| Registered Linux User 490858
Loading...