How can I get images to be viewed in a form? (VFP 5.0) I can get BMP file to display just fine, but JPG or Tif files only show as icons. Is there such a thing as an activeX image viewer or is there a better way.
...and by the way... in VFP7 all I did was set the
picture property to any .jpg image from the properties selector........
Unfortunately sometimes the cost of upgrading is prohibative and since VFP5.0 was pretty stable, find a workaround is sometimes the only solution. And your solution give up a background picture to the form and no possibility to resize, zoom etc.
To call the form could be :-
PUBLIC oViewer
DO FORM viewer NAME oViewer LINKED WITH lcFileName
where lcFileName is the name of the graphics file to view.
Alternatively, if the code were :-
PUBLIC oViewer
DO FORM viewer NAME oViewer LINKED
the lack of a parameter could be trapped in the .Init() event of the form with :-
ON ERROR THIS.mGetFile()
where the form method would use the GETFILE() function to return the name of a graphics file.
If the developer had Ghostscript and a suitable Postscript Printer driver installed, GETFILE() could also return the name of any suitable Windows file, the filename being passed as a parameter to a form method called .mCreateTiff()
There the file would be converted to a .tiff to become :-
THISFORM.oleImageEdit.DataField = path\filename.tiff
The Image Edit ActiveX control does not have an OLE DragDrop event, so one problem is that I don't yet see a way of dragging and dropping files from Windows Explorer or similar onto the form for viewing.
Placing another control over the ActiveX control to capture the OLE DragDrop does not work, as the ActiveX control is always on top.
Any Windows filename would have to dragged and dropped from within VFP.
The menu and toolbar could be extended by adding an 'Open' option/control which in turn would call .mGetFile().
You could call the form as the application is initialised and minimize it to the Windows taskbar, thereafter manipulating it through object references, and minimizing again when not in use.
It's the lack of an an OLE DragDrop event that's bugging me at the moment - any ideas or comments? HTH
One alternative solution to the OLE Drag and Drop problem would be to drag and drop onto the toolbar.
The toolbar and all controls on it would have the same code in the OLE DragDrop event which would give a reasonable target area on which to drop.
I don't think all this additional fuctionality should be necessarily written into the FAQ - what is important is to discuss the issues so that we get the structure that will support it. HTH
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.