Hi Kostas
Sorry for the delay. The issue here is that because they layers are positioned offset (not originating at 0,0) then they are not adequately centered (rightly or wrongly ImageEn considers the origin position when centering the view.
The solution is to give your layer group the origin of 0,0:
var
rect: TIERectangle;
begin
rect := ImageEnView1.LayersRect(False, True);
ImageEnView1.LayersRepositionAll(-rect.X, - rect.Y);
Here's a full example:
// Zoom so layers fill entire view area
// Make IEView consider all layers when calculating image bounds
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [loDynamicCanvas];
// Position layers so origin is 0,0
rect := ImageEnView1.LayersRect(False, True);
ImageEnView1.LayersRepositionAll(-rect.X, - rect.Y);
// Adjust zoom so all layers fill the view area
ImageEnView1.Fit();
In v10.0.2 you can also do it this way:
// Adjust view to show all layers
var
rect: TIERectangle;
begin
// Make IEView consider all layers when calculating image bounds
ImageEnView1.LayerOptions := ImageEnView1.LayerOptions + [loDynamicCanvas];
// Position layers so origin is 0,0
rect := ImageEnView1.LayersRect(False, True);
ImageEnView1.LayersRepositionAll(-rect.X, - rect.Y);
// Get updated layer rect and show it at size of control
rect := ImageEnView1.LayersRect(False, True);
ImageEnView1.VisibleBitmapRect := IERectangleToRect( rect );
end;
Nigel
Xequte Software
www.imageen.com