Hi Guys
Has anyone successfully used the PictureVal property of an Image control to display an image?
I read recently in Craig Berntson's blog -
http://www.craigberntson.com/archives/2004_09_01_archive.aspthe following :
You can use the PictureVal property of an Image object to hold the actual image data. This means you don’t have to refer to a disk file to display the image.
I have tried but no picture shows at runtime. I used the following PRG to allow me to select a picture which is then stored in the PictureVal property of an image object on a form.
* getpicture.prg
**********************
ON KEY LABEL CTRL+P do getpix in c:\vfp9\getpicture.prg
RETURN
**********************
FUNCTION getpix
LOCAL bb,cStr,cFile
bb = SYS(1270)
IF bb.baseclass=´Image´
cFIle = GETFILE("BMP,JPG,GIF","Select Picture")
IF EMPTY(cFile)
RETURN
ENDIF
cStr=FILETOSTR(cFile)
bb.Pictureval=cStr
ENDIF
I Select the Image object and then in the property sheet I select the PictureVal Property and place my cursor on this property.
I then hover my mouse over the image and press Ctrl+P. I then select a BMP - in my case fox.bmp in the VFP main directory. The picture shows up in the image object on the form and the property has some chrs in it.
However on running the form the picture is NOT displayed and the does not appear after that till I repeat the Ctrl+P stuff.
So how do you store the image in this property and display it without going to disk for it?
What is Craig talking about when he says that "you don’t have to refer to a disk file to display the image."