Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with image control

Status
Not open for further replies.

nevin2007

Programmer
Aug 21, 2009
31
IR
hi all
I have a image control and listbox in a form.
listbox show picture's name and when user click on a name image control show the picture.
i write this in interactivechange method of listbox
[blue]
thisform.image1.Picture=SYS(5)+SYS(2003)+[\form\]+ALLTRIM(nokli.picname)+[.jpg]
[/blue]
Everything works well when the program runs on the computer on which it is installed vfp
But when the program run on computer that is not installed vfp image control is empty and did not show anything without generating any error.
I distribute following dlls with application But it did not any help :
[blue]VFP9R.DLL
VFP9RENU.DLL
MSVCR71.DLL
GDIPlus.dll
[/blue]

I try that on 2 computers without VFP but Results are same.
Can anyone help me ?
thanks
 
Three quick questions:

Are you sure you've installed the image files into the right folder on the users' machines?

What happens if you put the images in C:\ and hardcode the path to match?

Why are you adding the complexity of the two SYS calls? I'd just use put the images in the same folder as the executable and use a relative path.

Geoff Franklin
 
Nevin2007,

The fact that the computer does not have VFP installed is almost certainly irrelevant. The point is that the runtime files are correctly installed. If they weren't, you wouldn't see the form at all - or any other part of the application.

It's much more likely that the images aren't in the place where the control expects to find them.

I suggest you place the following code in the InteractiveChange:

Code:
MESSAGEBOX(SYS(5)+SYS(2003)+[\form\]+ALLTRIM(nokli.picname)+[.jpg])

This will show you the full path and filename of the selected image. You can then check that the file is in fact present in that path.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
alvechurchdata said:
Are you sure you've installed the image files into the right folder on the users' machines?
alvechurchdata said:
It's much more likely that the images aren't in the place where the control expects to find them.

I try the following code :
Code:
thisform.image1.Picture=SYS(5)+SYS(2003)+[\form\]+ALLTRIM(nokli.picname)+[.jpg]
if !file(thisform.image1.Picture)
messagebox([file not found])
else
messagebox([ok])
endif

after i click listbox i saw ok message but image control didnt show any thing.
Is there another component is required to view photos ( Except the files that I wrote previously )
 
Do you have the Clip property of the image set to 0, the default? This clips the image and you might just be seeing a bit of white background in the top left-hand corner of the image. Change the Clip property to 1 - Isometric. This will shrink the image so that it fits the control but will maintain the shape of the image. Clip=2 will distort the image so that it's the same height and width as the control.

Geoff Franklin
 
Hi all
My problem was solved.
I do not know how but I deleted all the fxp files , recompiled forms and build the project again, I copied new executable file on other computer and my problem solved.
thank Of all those who offered the solution.

I think this must be a problem in VFP9 SP2.
 
I rather think it would be some FXP having older code with the wrong path to images.

In fact if you compile images into the EXE file, you can se t image.Picture='imagex.jpg' without any path. The EXE file will be aearched for the image and it will be used if compiled into the EXE. You can use the fullpath or the filename only in an IF/ELSE branch considering _VFP.startmode.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top