Fórum contador na tela #305170
12/12/2005
0
este é o código que estou utilizando...
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
num : integer;
begin
num := 0;
while num <= 100 do
Begin
Sleep(1000);
Label1.Caption := FloatToStr(num);
num := num +1;
end;
end;
end.
Adelor Silva
Curtir tópico
+ 0Posts
12/12/2005
Sabado
Observe uma ideia. se servir...
var
v1,v2: real;
begin
v1:= strtofloat(label1.caption);
v2:= strtofloat(´1´);
label1.Caption:= floattostr(v1+v2);
deixar
label1.caption:= ´0´;
Gostei + 0
12/12/2005
Nasguone
procedure TForm1.Button1Click(Sender: TObject);
var
num : integer;
begin
num := 0;
while num <= 100 do
Begin
num := num +1;
sleep(400);
Memo1.Lines.Add(IntToStr(num));
Label1.Caption := IntToStr(num);
Label1.Refresh;
end;
end;
end.
Gostei + 0
12/12/2005
Renatacoimbra
tenta algo como:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TConta = class(TThread)
private
protected
procedure Execute; override;
Procedure IncNum;
end;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Num: Integer;
implementation
{$R *.dfm}
procedure TConta.Execute;
begin
FreeOnTerminate := true;
while not terminated do begin
Synchronize(IncNum);
Form1.Label1.Caption := IntToStr(Num);
sleep(100);
end;
end;
Procedure TConta.IncNum;
begin
inc(Num);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
TConta.Create(False);
end;
end.
[]´s
Gostei + 0
13/12/2005
Adelor Silva
um abraço...
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)