The only way to magnify a portion of the image is with a magnify layer. See the Layers Demo.
procedure TForm1.MagnifyLayer1Click(Sender: TObject);
{ Create a magnify layer. }
{ Note: This only works if LayersSync is False }
var
iLayer: Integer;
begin
with ImageEnView1 do
begin
iLayer := LayersAdd; { Make the layers box visible and selectable and draw a box around the layer }
Note: If you do not want the layer to be selectable or moveable because it will always be at the same position then comment the next 3 lines or set all 3 to False. }
CurrentLayer.VisibleBox := True;
CurrentLayer.Selectable := True;
LayersDrawBox := True;
{ Give the layer a name }
Layers[iLayer].name := 'Magnifier';
{ Set the layers dimensions }
Layers[iLayer].Width := 320;
Layers[iLayer].Height := 240;
{ Set the layers position }
Layers[iLayer].PosX := 0;
Layers[iLayer].PosY := Layers[0].Bitmap.Height - Layers[iLayer].Height;
CurrentLayer.Magnify.Source := iemBackgroundLayer;
{ Enable a magnified layer }
CurrentLayer.Magnify.Enabled := MagnifiedEnabled1.EditValue;
{ Set the Magnification }
CurrentLayer.Magnify.Rate := Magnification1.EditValue;
{ Set magnify style }
CurrentLayer.Magnify.Style := iemRectangle;
{ Optional }
{ Allow selecting layers }
SelectLayers1.Down := True;
MouseInteract := [miMoveLayers, miResizeLayers];
Gestures.Pan.Enabled := False;
Gestures.Zoom.Enabled := False;
Gestures.LayerRotate.Enabled := False;
Gestures.LayerMove.Enabled := True;
Update;
end;
end;
To turn the magnifier off then remove the layer:
{ Remove the layer from ImageEnView }
{ Get the layer to be deleted }
iLayer := ImageEnView1.LayersCurrent;
ImageEnView1.LayersRemove(iLayer);
ImageEnView1.Update;
William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Custom Commercial ImageEn Development