Delphi之龟兔赛跑图片版(含有源代码和成品)

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, pngimage, StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Button1: TButton;
    Image1: TImage;
    Image2: TImage;
    Timer1: TTimer;
    qizi: TImage;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  timer1.Interval := 100;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  if (Image1.Left <= 800) and (Image2.Left <= 800) then
  begin
    Image1.Left := Image1.Left + 28;
    Image2.Left := Image2.Left + 20;
  end
  else
    timer1.Interval := 0

end;

end.
Delphi之龟兔赛跑图片版(含有源代码和成品)_第1张图片


下载地址:


你可能感兴趣的