image.stretch为true的话,图片会适应image的大小。算一下图片和image的比例,然后对你的鼠标所定位的矩形进行一下坐标变换吧。
比方说:image为100(w)*100(h),图片为200*200。鼠标取得的矩形为(50, 50, 100, 100),那么实际的矩形就应该为(100, 100, 200, 200)

解决方案 »

  1.   

    1、如果想保存缩放后的选择区域的缩放图内容,应在装入图后,调用下面过程
    procedure TForm1.RecreatePicture;
    Var bmp : TBitmap;
        r : TRect;
    begin
      If Not Image1.Stretch Then Exit;  Image1.Picture.Bitmap;
      Bmp := TBitmap.Create;
      bmp.Width := Image1.Width;
      bmp.Height := Image1.Height;
      r := Bounds( 0, 0, bmp.Width, bmp.Height );
      bmp.Canvas.StretchDraw( r, Image1.Picture.Graphic );
      Image1.Picture.Assign(bmp);
      bmp.Free;
    end;2、如果想保存缩放后的选择区域对应的原图内容,则修改bx,by,sx,sy的赋值如下:
      If Not Image1.Stretch Then
        Begin sx := x; sy := y; End
      Else
        Begin
          sx := Round(x*(image1.Picture.Width / image1.Width));
          sy := Round(y*(image1.Picture.Height / image1.Height));
        End;
      bx,by的设置也做相同处理
      

  2.   

    上例procedure TForm1.RecreatePicture中“Image1.Picture.Bitmap;”行为笔误,请自行删除