如何实现 图片的放大与缩小??
最好是 这样的接口函数:function fangda(scr:TBitMap):TBitMap;
function suoxia(scr:TBitMap):TBitMap;因为偶的《需求分析》和《概要设计》的接口都已经定型 不想在改
再改这个工程都要改死了!救命啊!

解决方案 »

  1.   

    if (分太少=true) or (信誉值<95) then
    begin
      showmessage('拒绝答题');
    end;
      

  2.   

    StretchBlt函数???怎么用呀!
      

  3.   

    DELPHI里面图形(如:TBitmap)封装了一个方法CopyRect它有三个参数,会用吧,
    通过他可以随心所欲的对原来的图形放大或缩小而且失帧很难看出来,试试吧。例:
    bmp.Canvas.CopyRect(Rect(0,0,bmp.Width,bmp.Height),
       MyCanvas,Rect(0,0,bmp.Width,bmp.Height),SRC_COPY);//抓图参数说明:
      1.Rect()//为你要缩小或放大的区域
      2.MyCanvas //你的现在图像存在的画布
      3.Rect()//这个为原来画布的区域
    最后一点
      拷贝到的地方为:bmp.Canvas.CopyRect的参数1的Rect()你自己定义的区域内。
      

  4.   

    你仔细看看,应该就能明白,放大和缩小都在里面。procedure TfrmPicView.OnZoom(Sender: TObject);
    var
      i: single;
    begin
      image1.Cursor := crDefault;
      if (sender as TMenuItem).name = 'miZoomIn' then
        i := 1.6
      else
        i := 0.625;
      image1.Width := round((image1.Width / image1.Picture.Width * i) *
        image1.Picture.Width);
      image1.height := round((image1.height / image1.Picture.height * i) *
        image1.Picture.height);
      if image1.Width >= width then
      begin
        if image1.Left > 0 then
          image1.Left := 0;
        image1.Cursor := crHandPoint;
      end
      else
        image1.Left := round((width - image1.Width) / 2);
      if image1.height >= height then
      begin
        if image1.Top > 0 then
          image1.top := 0;
        image1.Cursor := crHandPoint;
      end
      else
        image1.top := round((height - image1.height) / 2);  if image1.Width / image1.Picture.Width > 10 then
        miZoomIn.Enabled := false
      else
        miZoomIn.Enabled := true;
      if image1.Width / image1.Picture.Width < 0.1 then
        miZoomOut.Enabled := false
      else
        miZoomOut.Enabled := true;
    end;
      

  5.   

    像这种东东我一般的作法是~~~~~~~~~~~~~~~~~~~~直接找控件!!嘿嘿,那是谁说的聪明的程序员用Delphi来着?我强烈推荐用ImageEn,51Delphi上有的下的!这个东东牛死了!你几乎可以自己做个Photoshop!!
      

  6.   

    谢谢大哥 不过:是否有这样的接口函数:function fangda(scr:TBitMap):TBitMap;
    function suoxia(scr:TBitMap):TBitMap;因为偶的《需求分析》和《概要设计》的接口都已经定型 不想在改
    再改这个工程都要改死了!救命啊!
      

  7.   

    谢谢 哦下载了 imageen
     也SETUP了
    但 安装好后就不知道 该如何
    把 PAS 安装到 DELPHI上
    是其中的那个呀?望指导谢谢阿
      

  8.   

    帮偶看看 偶这样写错在哪里啊
    function  TForm1.fangdasuoxia(const scr:TBitMap;bili:double):TBitMap;
    var
     yheight,ywidth,
     hheight,hwidth:Longint;
     hrect,yrect:TRect;
    begin
      yheight:=scr.Height ;
      ywidth:=scr.Width ;
      hheight:=trunc(yheight*bili);
      hwidth:=trunc(ywidth*bili);
      Result:=TBitMap.Create ;
      yrect:=rect(0,0,ywidth,yheight);
      hrect:=rect(0,0,hwidth,hheight);
      Result.Canvas.CopyRect(hrect,scr.Canvas,yrect);
    end;procedure TForm1.Button1Click(Sender: TObject);
    var
     bb:TBitMap;
    begin
     bb:=TBitMap.Create ;
     bb.Assign(image1.Picture.Bitmap );
     bb:=fangdasuoxia(bb,1/2);
     image2.Picture.Bitmap :=bb;
    end;
      

  9.   

    canvas.CopyRect(BiggerRect,fTempBitmap.canvas,
                rect(Left-fPictureXPos,Top-fPictureYPos,Right-fPictureXPos,Bottom-fPictureYPos));
      

  10.   

    用Image控件设置strech属性为true,修改Image的大小就行了
      

  11.   

    上面说的已经可以了,
    放大:
      image1.Width:=image1.Width*1.2;
      image1.height:=image1.height+1.2;
      image1.strech:=true;
      form1.update;
    帮你顶一下
      

  12.   

    晕 偶要的象 photoshop那样 让图片 放大缩小
    不是 让IMAGE控件 变化的!
      

  13.   

    用 StretchBlt 把图像数据按新的大小画到另一个 DC 上,再把新的 DC 的数据保存下来就可以了
      

  14.   

    o   您是想像放大镜那样呀,用CopyRect试试行吗?