如何能实现以鼠标位置为中心的图像放大和缩小呢?

在scrollbox上放一个image控件,可以通过下列代码实现图像的放大和缩小。这种方法很简单,就是利用image控件的AutoSize和Stretch属性实现,但这种方法是以左上角(image的left和top)为中心进行放大和缩小,用起来很不方便。如何能实现以当前鼠标位置为中心的图像放大和缩小呢?是不是要计算ScrollBox控件滚动条的位置?

var
  fdxs:integer;//缩放系数

procedure TMDIChild.FormCreate(Sender: TObject);
begin
  fdxs:=100;
end;


procedure TMDIChild.ScrollBox1MouseWheelDown(Sender: TObject;
  Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
begin
  fdxs:=fdxs+10;
  if fdxs>200 then
  begin
    fdxs:=200;
  end
  else
  begin
    image1.AutoSize:=true;
    image1.Stretch:=false;
    image1.AutoSize:=false;
    image1.Stretch:=true;
    image1.Height:=trunc(image1.Height * fdxs/100) ;
    image1.Width:=trunc(image1.Width * fdxs/100);
  end;
end;

procedure TMDIChild.ScrollBox1MouseWheelUp(Sender: TObject;
  Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
begin
  fdxs:=fdxs-10;
  if fdxs<60 then
  begin
    fdxs:=60;
  end
  else
  begin
    image1.AutoSize:=true;
    image1.Stretch:=false;
    image1.AutoSize:=false;
    image1.Stretch:=true;
    image1.Height:=trunc(image1.Height * fdxs/100) ;
    image1.Width:=trunc(image1.Width * fdxs/100);
  end;
end;
 

image设置可拖拽 用鼠标拖拽

这是Delphi吧