procedure TForm1.Button1Click(Sender: TObject);
var
 newbmp:TBitmap;
 i,bmpheight,bmpwidth:integer;
begin
 newbmp:=TBitmap.Create ;
 newbmp.Height :=image1.Height ;
 newbmp.Width :=image1.Width ;
 bmpheight:=image1.Height+10 ;
 bmpwidth:=image1.Width+10 ;
 for i:=10 to bmpheight do
  begin
   newbmp.Canvas.CopyRect (rect(0,bmpheight-i,bmpwidth,bmpheight),
     image1.canvas,rect(0,0,bmpwidth,i));
   form1.Canvas.Draw (0,0,newbmp );
  end;
  newbmp.free;
end;

解决方案 »

  1.   

    在For循环中计算不精确!
    因为i从10变化到bmpheiht,而Image的宽度和高度比newbmp的要小!所以Image1.canvas的rect计算有误!自己修改吧!问题倒不是很难。
    for i:=10 to bmpheight do
      begin
      newbmp.Canvas.CopyRect (rect(0,bmpheight-i,bmpwidth,bmpheight),
        image1.canvas,rect(0,0,bmpwidth,i));
      form1.Canvas.Draw (0,0,newbmp );
      end;
      newbmp.free;
    end; 
      

  2.   

    而且你的循环的效率很低,每次都从0,0开始CopyRect,应该把已经Copy的Rect部分去掉,这样能加快速度,减少闪烁!
      

  3.   

    问题不是很难,就是半天没人回答,不爽!谢谢Kingron兄!我就尽量再给你加两分。
      

  4.   

    看看下面的拉动效果:
    //也不知道是不适合你的要求。
    procedure TForm1.Button1Click(Sender: TObject);
    var
    i:integer;
    begin
      for i:=0 to Image1.Width do
      begin
        form1.Canvas.CopyRect(Rect(i,0,i+1,image1.Height),image1.Canvas,Rect(i,0,i+1,image1.Height));
        sleep(20);
      end;
    end;