Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How Do I store image data in PictureVal
Message
From
08/10/2005 04:11:17
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
08/10/2005 00:33:58
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01057389
Message ID:
01057405
Views:
20
>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.asp
>
>the 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."

Bernard,
I think it's not a good way to use for disk based files (meaning file is already on disk-not stored in a memo or blob field).
If you'd use it with disk based files use Picture property instead. PictureVal uses twice the memory needed to render it when used with file references.
If you store your pictures in BLOB field then you should go with PictureVal.
oForm.myImage.PictureVal = myTable.myBLOBfield
If you store file name and path in a field (or get file path at run time as you did with getfile() or getpict()) or would directly store to a property then use Picture property:
oForm.myImage.Picture = m.cFile
oForm.myImage.Picture = myTable.myImageNameAndPath
or as Property in PEM sheet:
Picture: c:\my Path\myImageFile.jpg
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform