INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Tips -N- Tricks

How can I create a viewer using the Kodak Image Edit ActiveX control by ChrisRChamberlain
Posted: 4 Sep 02

The VFP control .Image has a limited functionality in terms of image file types supported and the ability to view an image file at different resolutions.

The ActiveX control, Kodak Image Edit, is one of a suite of ActiveX controls that comprise the MS Imaging application, which comes with all versions of Windows with exception of XP. (It will run in XP)

This FAQ outlines the methodology required to create a simple bare bones but powerful image viewer that will resolve the previously mentioned deficiencies of the VFP Image control.

You require a :-

Top-level form
The Image Edit ActiveX control
A toolbar class
A menu

Create a top-level form and drop onto it the Image Edit ActiveX control, renaming it 'oleImageEdit'

In the .Init() event of the form put :-

LPARAMETERS filename

WITH THIS
    .Resize()
    .oleImageEdit.DataField = filename
    .oleImageEdit.Zoom = 100
ENDW

In the .Resize() event of the form put :-

WITH THIS.oleImageEdit
    .Height = THISFORM.Height
    .Left = 0
    .Top = 0
    .Width = THISFORM.Width
ENDW

In the .Unload() event of the form put :-

RELEASE oViewer

To call the form :-

PUBLIC oViewer
DO FORM viewer NAME oViewer LINKED WITH lcFilename

where lcFileName is the path\filename.ext of the graphics file to be viewed.

The menu/toolbar combination extends the functionality by providing the means to navigate the pages of a multipaged .tiff file and select different zoom levels.

The options required for .tiff navigation are :-

First Page
Previous Page
Next Page
Last Page

The .oleImageEdit.ActivePage value determines the page to be viewed, and .oleImageEdit.PageCount returns the number of pages in a .tiff.

The .oleImageEdit.FitTo() method takes a parameter of :-

0 - Best Fit
1 - Fit to width
2 - Fit to height
3 - Inch to Inch (Actual size)

which determines the view.

Additional preset zoom levels can be added and a spinner should be added to the toolbar, the .InterActive() change event changing the zoom factor.

The image file types that the viewer supports are :-

TIFF
AWD
BMP
PCX
DCX
JPG
XIF
GIF
WIFF

The viewer's fuctionality can be extended by the addition of OLE Drag and Drop on the toolbar - it's not possible on the form.

This would allow a user to drag and drop graphics files from Windows Explorer, etc, for viewing.

.oleImageEdit supports VFP drag and drop so filenames could be dragged and dropped from a VFP application.

A menu option/graphical checkbox could call a form method called .mGetFile() which would use the GETFILE() function to return a filename for viewing.

By installing a suitable Postscript Printer driver and Ghostscript, VFP reports can be printed to a .ps file and there to a .tiff for previewing.

Additionally, by printing from Word, FI, through the Postscript Printer driver, multiple paged word docs can be viewed as a .tiff.

Have fun!

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close