| 
        
          | 
              
                | T O P I C    R E V I E W |  
                | agnes | Posted - May 25 2013 : 18:48:29 Hi,
 
 I am trying to figure out the following...
 
 I have a bitmap that will be zoomed larger than its ImageEnView1 component. Now, whereever I pan the image to, I would like to zoom in and out (with a button/code) without the current TopLeft pixel moving. I would expect it to move when zooming smaller than the component would allow for. Thanks.
 --Aggie
 |  
                | 2   L A T E S T    R E P L I E S    (Newest First) |  
                | agnes | Posted - May 29 2013 : 20:33:13 fab,
 
 Thanks for pointing me in the right direction. Here is what I came up with. Works well with 50%, 100%, 200%, etc.
 
 //--------------------------------------------------------------------
 procedure TForm1.ZoomFromTopLeft(AImage: TImageEnVect; AZoom: double);
 var
 newViewX, newViewY : integer ;
 begin
 with AImage do
 begin
 newViewX := Trunc(AZoom / Zoom * ViewX);
 newViewY := Trunc(AZoom / Zoom * ViewY);
 Perform(WM_SETREDRAW, 0, 0);
 Zoom := AZoom;
 ViewX := newViewX;
 ViewY := newViewY;
 Perform(WM_SETREDRAW, 1, 0);
 Invalidate;
 end;
 end;
 //--------------------------------------------------------------------
 
 I was ready to tear my hair out trying to find a bitmap point, screen point, client point -- that could be plugged into the ZoomAt procedure. FYI, my project is for viewing census scans, and needs to remain at the same line/column when zooming. Thanks again!
 
 
 |  
                | fab | Posted - May 27 2013 : 13:13:48 Hi,
 ImageEn "direct" the zoom at the center.
 You may change this, scrolling to the pixel you want to display, just after setting zoom. Example:
 
 ImageEnVect1.Zoom := ....;
 ImageEnView1.ViewX := 0;
 ImageEnView1.ViewY := 0;
 
 You could also set ImageEnView1.Center=false (this is not an alternative way).
 
 |  |  
 |