[Gambas-user] Images and Pictures

Benoît Minisini gambas at ...1...
Fri Dec 31 14:43:24 CET 2010


> Good morning to all,
> 
> i make an example for the Image class.
> i want to demostrate the methods of Image class.
> the example will Clear  Copy  Draw  Fill  Flip  Mirror  Replace  Resize
> Rotate  Save  Stretch a picture in an Image class and put the result in
> a PictureBox.
> 
> Firstly i want the picture from an Image object to put it in a
> Picturebox without modify image.
> i use the following code:
> 
> ------------------------------
> PRIVATE hImage AS Image
> 
> PUBLIC SUB Form_Open()
> 
> ME.Center
> hImage = NEW Image(500, 375, FALSE)
> hImage.Load(Application.Path & "/nature.png")
> PictureBox1.Picture = hImage.Picture
> 
> END
> ------------------------------
> 
> but the PictureBox1 at runtime is empty.
> Why? what am i doing wrong?

I guess you didn't read the documentation of the Image class :-). 

Image.Load() is a static method. So:

hImage = Image.Load(Application.Path &/ "nature.png")

And you didn't specify which version of gambas you use. Please do make an 
example for Gambas 3!

Regards,

-- 
Benoît Minisini




More information about the User mailing list