Page 1 of 1

picturebox vs imagview

Posted: Friday 1st November 2019 11:49am
by bill-lancaster
Two questions really,
1) What are the differences between these two controls?
2) What file types are supported?

I'm looking to display image/document files 'in-programme'.

Thank you

Gambas 3.14

Re: picturebox vs imagview

Posted: Friday 1st November 2019 4:37pm
by cogier
This is an interesting question. The main difference, as I see it, is that a Picture is loaded from disk and displayed while an Image is loaded into memory and kept there so it can be manipulated in memory. So, I presume, if you were writing a photo album program you would use a PictureBox. If you were writing an image manipulation program use an ImageView. ImageView only accepts Images while a PictureBox can handle both Pictures and Images.
I'm looking to display image/document files 'in-programme'.
If this means that you have a quantity of files that you can load to display and you don't need to manipulate them then I suggest PictureBoxes.

Unless somebody knows otherwise......

Re: picturebox vs imagview

Posted: Friday 1st November 2019 4:46pm
by sjsepan
Re: #1, there's not a lot in the Wiki help describing the difference except in terms of Properties/Methods/Events, but they have different lineages:

Control (gb.qt4)
Container (gb.qt4)
DrawingArea (gb.qt4)
PictureBox (gb.qt4) http://gambaswiki.org/wiki/comp/gb.qt4/picturebox
Property Image As Image
Property Picture As Picture

Control (gb.qt4)
Container (gb.qt4)
UserControl (gb.qt4)
ImageView (gb.form) http://gambaswiki.org/wiki/comp/gb.form/imageview
Property Image As Image

Not having used either yet, the most interesting difference I can see is that PictureBox descends from DrawingArea:
This control implements an area that can be drawn by the application. It has two behaviors, standard and cached, defined by the Cached property.

In standard mode, The DrawingArea will raise the Draw event each time it needs to be refreshed.

In cached mode, The drawing is done once, by using the DrawingArea control as a drawing device. This drawing is stored inside an internal Picture that is used by the DrawingArea to refresh itself.

By default, the drawing must be done by using the Draw class. If you set the Painted property, the drawing will have to be done by the Paint class, and so will be anti-aliased.

Since 3.4

The Painted is useless and therefore deprecated since Gambas 3.4.
http://gambaswiki.org/wiki/comp/gb.qt4/drawingarea

So, as cogier points out that PictureBox loads the picture from disk, ImageView seems to generate the Image from programming instructions, although it does have a Picture property too.
No clue about the formats.

Re: picturebox vs imagview

Posted: Friday 1st November 2019 5:38pm
by bill-lancaster
Thanks for that, I'll go with picturebox.
I'll find out one way or another which file type are supported and report them here.