我的应用程序应该生成一个随机和计算答案,然后将其放在面板上的编辑框中,然后面板应该向下移动并重复(我已经完成了所有这些)。好的,问题是当面板向下移动时,没有其他工作,就好像一切都被禁用了。
unit Unit5;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, jpeg, ExtCtrls, StdCtrls, math, Buttons;
type
TForm1 = class(TForm)
Image1: TImage;
Panel1: TPanel;
Edit1: TEdit;
Panel6: TPanel;
Shape1: TShape;
Panel7: TPanel;
Label1: TLabel;
Edit6: TEdit;
Label2: TLabel;
Button1: TButton;
Image5: TImage;
Edit7: TEdit;
Image2: TImage;
Label3: TLabel;
Timer1: TTimer;
procedure FormActivate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Image2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
var hori : integer;
vert : integer;
back : integer;
value1 : integer;
value2 : integer;
answer : integer;
star: integer;
stranswer: string;
k : integer;
{$R *.dfm}
procedure TForm1.FormActivate(Sender: TObject);
begin
panel1.hide;
panel7.Hide;
back:=0;
star:=0;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
stranswer:= inttostr(answer);
if edit6.Text=stranswer then
begin
star:=star+1;
edit7.text:=inttostr(star);
end;
button1.Caption:='Next';
panel7.Show;
edit6.SetFocus;
panel1.show;
randomize;
hori:=random(840);
value1:=random(10);
value2:=random(10);
panel1.Top:=0;
panel1.Left:=hori;
update;
answer:=value1+value2;
edit1.text:=(' '+inttostr(value1)+' + '+inttostr(value2));
for k:= 1 to 512 do
begin
vert:= vert+1;
panel1.Top:= vert;
update;
sleep(50)
end;
end;
procedure TForm1.Image2Click(Sender: TObject);
begin
back:=1;
form5.Close;
button1.show;
end;
end.
如果你愿意,我可以给你发一张表格的照片。如果可以请帮助我。