IMAGE不能加滚动条,要把它方在TScrollBox控件上。

解决方案 »

  1.   

    100% image.autosize := true;
      

  2.   

    100% image.autosize := true;
      

  3.   

    等高:
      Image1.AutoSize :=false;
      Image1.Width :=Image1.Height ;
      Image1.Stretch :=true;
    等宽:
      Image1.AutoSize :=false;
      Image1.Height:=Image1.Width  ;
      Image1.Stretch :=true;
    100%:
      Image1.Stretch:=false;
      Image1.AutoSize:=True;
      

  4.   

    To Apollo47(阿波罗):   再请教一下,按你的方法确实解决了一部分问题,可是如何让图片在等高的前提下,其宽度按比例缩放显示呢??即:图片的宽、高比例依然不变,想ACDSEE那样。
     
      

  5.   

    通过Image.Picture的宽度与高度,自己计算。
      

  6.   

    例如:
    首先Image1.Stretch := True;procedure TForm1.btnHeightClick(Sender: TObject);
    begin
      Image1.Width := Round((Image1.Height / Image1.Picture.Height) * Image1.Picture.Width);
    end;procedure TForm1.btnWidthClick(Sender: TObject);
    begin
      Image1.Height := Round((Image1.Width / Image1.Picture.Width) * Image1.Picture.Height);
    end;
      

  7.   

    等高,等宽:
    image.autosize:=false;
    Image.Stretch:=True;
    100%:Image.Stretch:=false;
    另: 图片高(宽)超出IMAGE时,IMAGE如何自动加滚动条??
    将image控件放入frames中 ,且
    image.autosize:=true;
    Image.Stretch:=false;
     
      

  8.   

    更正:::::::::
    等高:
      Image1.AutoSize :=true;
      Image1.AutoSize :=false;
      Image1.Width(由你设)
      Image1.Stretch :=true;
    等宽:
      Image1.AutoSize :=true;
      Image1.AutoSize :=false;
      Image1.hight(由你设)
      Image1.Stretch :=true;
    100%:Image.Stretch:=false;
    另: 图片高(宽)超出IMAGE时,IMAGE如何自动加滚动条??
    将image控件放入frames中 ,且
    image.autosize:=true;
    Image.Stretch:=false;
      

  9.   

    ------想ACDSEE那样--------
    应该是根据给定的区域大小,自动变化图像大小,且显示在区域中央
    我写了一下下面的函数,可以达到AcdSee中的效果//让图像显示在面版pnlPicture的中央
    procedure TfrmPicure.btnShowInPanelClick(Sender: TObject);
    var
      HeightRatio, WidthRatio: Double;
    begin
      //分别取得高度、宽度与显示区域的比例
      HeightRatio := Image1.Picture.Height / pnlPicture.Height;
      WidthRatio := Image1.Picture.Width / pnlPicture.Width;
      //图像大于pnlPicture区域
      if (HeightRatio > 1) or (WidthRatio > 1) then
      begin
        Image1.AutoSize := False;
        //若高度比例大于宽度比例,则缩放宽度
        if HeightRatio > WidthRatio then
        begin
          //高度与pnlPicture一致
          Image1.Top := pnlPicture.Top;
          Image1.Height := pnlPicture.Height;
          //变化其宽度,并显示在中间
          Image1.Width := Round(Image1.Picture.Width / HeightRatio);
          Image1.Left := pnlPicture.Left + (pnlPicture.Width - Image1.Width) div 2;
        end
        else
        //若高度比例小于宽度比例,则缩放高度
        begin
          Image1.Left := pnlPicture.Left;
          Image1.Width := pnlPicture.Width;
          Image1.Height := Round(Image1.Picture.Height / WidthRatio);
          Image1.Top := pnlPicture.Top + (pnlPicture.Height - Image1.Height) div 2;
        end;
      end
      //图像可以在pnlPicture区域完整显示,即图像小于pnlPicture区域
      else
      begin
        Image1.AutoSize := True;
        //显示在正中央
        Image1.Top := pnlPicture.Top + (pnlPicture.Height - Image1.Height) div 2;
        Image1.Left := pnlPicture.Left + (pnlPicture.Width - Image1.Width) div 2;
      end;
    end;