Envision Library Image

Frequently asked questions

Question 1. How do I remove the evaluation message box after registering the library?

After registering the Envision Image Library you should have received a user name and password to unpack the source code. Here are the instructions for version 2 of the library.
  1. Unpack the source code with the Envision source code unpacker. Open the EnUnpack2.EXE program in the base directory of Envision. Then select the file Source.Pak. Enter you user name and password to unpack. This will create a file called Source.Zip. Unzip the file with the "sub-directories" option. This will create the CSource directory just below the base folder.
  2. Remove the Trial folder from your project directory options. The simplest way is to rename or delete the Trial folder. Rebuild your projects. Since the Trial folder is no longer available, this will force rebuilding with the source code.

Question 2. I am receiving an access violation from the C++ Builder compiler. How can it be prevented?

When compiling with C++ Builder you may experience an access violation in DccN0.Dll (where N is the C++ Builder version). If the "Local Symbols" and "Reference info" check boxes are cleared in the project Pascal compiler options, the error disappears.

Question 3.  I am trying to compile the design time package but I am missing the Envision.Res file. Where can I download the file?

Since version 1.1 it is no longer required to recompile the design-time package after registering. See Question 1. If you want to recompile the package though, the Envision.Res file may be obtained from the download section.

Question 4. When opening a tiff file, the exception ETiffError, with message "TIFFGetField: Tag = NNN". How can it be prevented?

This is usually a "normal" exception handle by Envision itself, when the tiff file is missing a tag; Envision will use a default value for that tag. Turning off "break on exception" in your debugger options, will prevent the exception from interrupting the IDE. When the program is executed outside the IDE, the exception is handled and the flow of the program is not interrupted.

Note that in version 2, most of these "internal" exceptions are no longer raised. 

Question 5. How can mouse events be captured on the TImageScrollBox component?

The TImageScrollBox component captures the mouse events to support the mouse mode specified in the MouseMode property. The MouseMode property determines how the mouse events are handled on the TImageScrollBox. As of version 1.1 there are three predefined modes, mmDrag, mmQuickSelect, and mmSelect. 

It is possible to create custom mouse handling by setting the MouseMode property to mmUser, and assigning to the MouseHandler property an object derived from the TMouseHandler class. There are more details in the help file under the MouseHandler topic. The EnRubber.Pas is a good example of a complex mouse handler.

As of version 2, there are also the OnImageMouseDown, OnImageMouseUp, OnImageMouseMove, and OnImageDblClick events.

Question 6. How can multiple images be printed on the same page?

It's possible to print multiple images on the same page by setting the UsePrintJob property to False in the 
TDibGraphicPrinter object.

For example,

GraphicPrinter.UsePrintJob := False;

Printer.BeginDoc;

GraphicPrinter.LeftMargin := 50;
GraphicPrinter.TopMargin := 50;
GraphicPrinter.Print(Graphic1);

GraphicPrinter.LeftMargin := 500
GraphicPrinter.TopMargin := 500;
GraphicPrinter.Print(Graphic2);

Printer.EndDoc;

The GetPrinterMetrics procedure may be used to determine the pixels per inch in order to position the images.

Question 7. How to perform a zoom to selection with the mmQuickSelect mouse mode?

The TImageScrollBox component has a ZoomToSelection method which works when the mouse mode is mmSelect and there is a selection currently active. When using the mmQuickSelect mouse mode, the OnQuickSelect mouse handler needs to explicitly handle the "zooming". Here is a code snippet that will zoom to the selection:

var
    XZoom       : Single;
    YZoom       : Single;
    OldZoom     : Single;
begin 

    OldZoom := Sender.ZoomPercent;

    XZoom := Sender.ZoomPercent * (Sender.Width / (Rect.Right - Rect.Left + 1) * 1.0);
    YZoom := Sender.ZoomPercent * (Sender.Height / (Rect.Bottom - Rect.Top + 1) * 1.0);

    Sender.ZoomPercent := Min(Min(XZoom,1000), YZoom);

    Sender.HorzScrollBar.Position := SafeTrunc(Rect.Left * (Sender.ZoomPercent / OldZoom));
    Sender.VertScrollBar.Position := SafeTrunc(Rect.Top * (Sender.ZoomPercent / OldZoom));
end;