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
picturebox vs imagview
-
- Posts: 195
- Joined: Tuesday 26th September 2017 3:17pm
- Location: NW England
- cogier
- Site Admin
- Posts: 1126
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: picturebox vs imagview
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.
Unless somebody knows otherwise......
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.I'm looking to display image/document files 'in-programme'.
Unless somebody knows otherwise......
Re: picturebox vs imagview
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:
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.
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:
http://gambaswiki.org/wiki/comp/gb.qt4/drawingareaThis 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.
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.
-
- Posts: 195
- Joined: Tuesday 26th September 2017 3:17pm
- Location: NW England
Re: picturebox vs imagview
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.
I'll find out one way or another which file type are supported and report them here.