delphi做个小循环程序

来源:百度知道 编辑:UC知道 时间:2024/05/23 09:53:50
两个edit框 分别是 edit1 edit2
edit1 输入开始数 edit2输入结束数
再加个label1 显示当前的数
按按钮buttion1 就循环从 edit1 到edit2 在label1 显示当前的数
怎么做呢?

加个时钟 TIME

Private Sub
time1.Visible = False
a = Val(edit1)
b = Val(edit2)
Label1 = a
End Sub

Private Sub Button1_Click()
time1.Visible = True
End Sub

time1_______________________
Label1 = Label1 + 1
if val(label1)>=val(label2) than label1=a

好拉,就这样啦,里面可能有点小错误,你自己研究下吧,我没装那软件,都不知道了

procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
for i:= StrToInt(Edit1.Text) to StrToInt(Edit2.Text) do
begin
Application.ProcessMessages;
Sleep(200);
StaticText1.Caption:= IntToStr(i);
end;
end;