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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I create a viewer using the Kodak Image Edit ActiveX control

Tips -N- Tricks

How can I create a viewer using the Kodak Image Edit ActiveX control

by  ChrisRChamberlain  Posted    (Edited  )
The VFP control [color blue].Image[/color] 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 [color blue].Init()[/color] event of the form put :-
[color blue]
LPARAMETERS filename

WITH THIS
[tab].Resize()
[tab].oleImageEdit.DataField = filename
[tab].oleImageEdit.Zoom = 100
ENDW
[/color]
In the [color blue].Resize()[/color] event of the form put :-
[color blue]
WITH THIS.oleImageEdit
[tab].Height = THISFORM.Height
[tab].Left = 0
[tab].Top = 0
[tab].Width = THISFORM.Width
ENDW
[/color]
In the [color blue].Unload()[/color] event of the form put :-
[color blue]
RELEASE oViewer
[/color]
To call the form :-
[color blue]
PUBLIC oViewer
DO FORM viewer NAME oViewer LINKED WITH lcFilename
[/color]
where [color blue]lcFileName[/color] 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 [color blue].oleImageEdit.ActivePage[/color] value determines the page to be viewed, and .oleImageEdit.PageCount returns the number of pages in a .tiff.

The [color blue].oleImageEdit.FitTo()[/color] 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 [color blue].InterActive()[/color] 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.

[color blue].oleImageEdit[/color] 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 [color blue].mGetFile()[/color] which would use the [color blue]GETFILE()[/color] 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!
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top