Index: fviewer.pas
===================================================================
--- fviewer.pas	(revision 4996)
+++ fviewer.pas	(working copy)
@@ -695,7 +695,7 @@
             UndoEY:=Y;
           end;
         end;
-      if not (gboxHightlight.Visible) and not (gboxPaint.Visible) then
+      if not (gboxHightlight.Visible) and not (gboxPaint.Visible) and (sboxImage.AutoScroll) then
     begin
       sboxImage.VertScrollBar.Position:=sboxImage.VertScrollBar.Position+tmpY-y;
       sboxImage.HorzScrollBar.Position:=sboxImage.HorzScrollBar.Position+tmpX-x;
@@ -1336,16 +1336,28 @@
 procedure TfrmViewer.miStretchClick(Sender: TObject);
 begin
   miStretch.Checked:= not miStretch.Checked;
-  Image.Stretch:= miStretch.Checked;
-  Image.AutoSize:= not Image.Stretch;
-  Image.Proportional:= Image.Stretch;
   if gboxHightlight.Visible then UndoTmp;
   if miStretch.Checked then
     begin
+      sboxImage.AutoScroll:=false;
+      sboxImage.HorzScrollBar.Visible:=false;
+      sboxImage.VertScrollBar.Visible:=false;
+      sboxImage.HorzScrollBar.Position:=0;
+      sboxImage.VertScrollBar.Position:=0;
+
       gboxPaint.Visible:=false;
       gboxHightlight.Visible:=false;
       gboxView.Visible:=true;
+    end
+  else
+    begin
+      sboxImage.HorzScrollBar.Visible:=true;
+      sboxImage.VertScrollBar.Visible:=true;
+      sboxImage.AutoScroll:=true;
     end;
+  Image.Stretch:= miStretch.Checked;
+  Image.AutoSize:= not Image.Stretch;
+  Image.Proportional:= Image.Stretch;
   AdjustImageSize;
 end;
 
@@ -1723,19 +1735,16 @@
 begin
   if miStretch.Checked then
      begin
-       Image.Stretch:=true;
-       Image.AutoSize := true;
        //if gboxHightlight.Visible or gboxPaint.Visible then Image.Center:=false else Image.Center:=true;
        Image.Center:=true;
        if (Image.Picture.Width > sboxImage.ClientWidth) or  (Image.Picture.Height > sboxImage.ClientHeight) then
          begin
+           Image.Stretch:=true;
+           Image.AutoSize:=false;
            Image.Left:= 0;
            Image.Top:= 0;
-           Image.AutoSize := false;
            Image.Width:= sboxImage.ClientWidth;
            Image.Height:= sboxImage.ClientHeight;
-           sboxImage.HorzScrollBar.Visible:=false;
-           sboxImage.VertScrollBar.Visible:=false;
            // show image resolution and scale
            if Image.Picture.Width < Image.Width then
              begin
@@ -1758,6 +1767,8 @@
          end
        else
          begin
+           Image.Stretch:=false;
+           Image.AutoSize:=true;
            Image.Left:= (sboxImage.ClientWidth-Image.Picture.Width) div 2;        //move image to center
            Image.Top:=  (sboxImage.ClientHeight-Image.Picture.Height) div 2;
            sResolution:= IntToStr(Image.Picture.Width) + 'x' + IntToStr(Image.Picture.Height);
