如题,如何用delphi制作卷动背景???
请高手们帮帮忙。

解决方案 »

  1.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, AppEvnts, ExtCtrls;type
      TForm1 = class(TForm)
        Image1: TImage;
        Image2: TImage;
        Timer1: TTimer;
        procedure FormCreate(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
      public
        procedure BltBack();//画滚动背景方法
      end;var
      Form1: TForm1;
      x:dword;//记录背景移动的坐标
      T:dword;//记录刷新时间间隔implementation{$R *.dfm}procedure TForm1.BltBack;
    Const imgwidth= 320; //图象宽
          imgheight=240;//高
    begin
      if (GetTickCount-T)>100 then  //刷新间隔时间200毫秒
      begin
        T:=GetTickCount;
        if (x>imgwidth) then x:=0 else Inc(x,2);//从左向右
      end;
      bitblt(Image1.Canvas.Handle,x,0,imgwidth,imgheight,Image2.canvas.Handle,0,0,SrcCopy); //画往右的贴图
      bitblt(Image1.Canvas.Handle,0,0,x,imgheight,Image2.Canvas.Handle,imgwidth-x,0,srccopy);//画填补的缺图
      image1.Canvas.TextOut(x,0,inttostr(x));//可以看到移动的相对位置
    end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      T := GetTickCount;
    end;procedure TForm1.Timer1Timer(Sender: TObject);
    begin
    BltBack;  //画背景
    end;end.