下面这段程序,在Rotated90把AImage的AImage.Picture.Bitmap.Height和AImage.Picture.Bitmap.Width赋一个定值,比如说100,30,可以正确的显示要load的内容,但是一旦进行缩放,即执行了imgMousemove中的imgStretch之后,却无法正确显示要load的内容,这是为什么呢?
    
procedure TForm1.CreateImg;
begin
    Screen.cursor:=crDefault;
    img:=TImage.Create(self);
    img.Parent:=sbxMain;
    img.AutoSize:=true;
    img.Stretch:=true;
    img.Picture.LoadFromFile('H:\Program Files\Borland\Delphi6\Projects\画图new\画图\R.Bmp');
    img.Left:=200;
    img.Top:=200;
    imheight:=img.Height;
    imwidth:=img.Width;
    img.PopupMenu:=PopupMenu1;
    img.Visible:=true;
    img.OnMouseDown:=form1.ImgMouseDown;
    img.OnMouseMove:=form1.ImgMouseMove;
    img.OnMouseUp:=form1.ImgMouseUp;
    img.Transparent:=true;
end;procedure TForm1.sbRoundRectClick(Sender: TObject);
begin
    createimg;
end;procedure TForm1.ImgMouseDown(Sender: TObject;  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
    if ssleft in Shift then 
    begin
        modified:=true;
        X1:=X;Y1:=Y;
        if (X-imwidth+5>0) then 
        begin
            imgstretch:=true;
            ImgMoving:=false;
            beep();
        end else begin ImgMoving:=true;imgstretch:=false;
        end;
        if imgstretch=true then screen.Cursor:=crsizeall
        else if ImgMoving then screen.Cursor:=crhandpoint
        else screen.Cursor:=crdefault;
    end;
end;
procedure TForm1.ImgMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
    if ImgMoving=true then 
    begin
        (Sender as TIMage).left:=(Sender as TIMage).left+X-x1; 
        (sender as TImage).top:=(sender as TImage).top+Y-Y1;
    end;
    if imgstretch then 
    begin
        (Sender as TIMage).AutoSize:=false;
        (Sender as TIMage).width:=imwidth+X-x1;
        (sender as TImage).height:=imheight+Y-Y1;
    end;
end;procedure TForm1.ImgMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
    ImgMoving:=false;
    imgstretch:=false;
    imwidth:=(Sender as TIMage).width;
    imHeight:=(Sender as TIMage).Height;
end;procedure TForm1.Rotated90(AImage:TImage);
var imgheight,imgwidth,i,j:integer;imag:TImage;
begin
    imgwidth:=AImage.Width;
    imgheight:=AImage.height;
    AImage.Picture.Bitmap.Height:=imgwidth;
    AImage.Picture.Bitmap.Width:=imgheight;
    Edit2.Text:='AImage.Height= '+IntToStr(AImage.Picture.Bitmap.Height)+'; '+'AImage.Width= '+IntToStr(AImage.Picture.Bitmap.Width);
    AImage.Stretch:=true;
    AImage.AutoSize:=false;
    AImage.Picture.LoadFromFile('H:\Program Files\Borland\Delphi6\Projects\画图new\画图\rr.bmp');
end;//PopupMenu的旋转90度的触发事件
procedure TForm1.N901Click(Sender: TObject);
begin
    Rotated90(img);
end;