unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Label1: TLabel; Timer1: TTimer; procedure Timer1Timer(Sender: TObject); procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end;var Speed: Single = 1.0; Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject); begin Speed := 1.1; end;procedure TForm1.FormCreate(Sender: TObject); begin Timer1.Interval := 25 ; end;procedure TForm1.Timer1Timer(Sender: TObject); begin Timer1.Interval := Round(Timer1.Interval * Speed ); if Timer1.Interval > 1000 then Timer1.Enabled := False; Label1.Left := Label1.Left + 2; end;end. 窗体 object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 243 ClientWidth = 472 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object Label1: TLabel Left = 24 Top = 56 Width = 31 Height = 13 Caption = 'Label1' end object Button1: TButton Left = 32 Top = 0 Width = 75 Height = 25 Caption = 'Button1' TabOrder = 0 OnClick = Button1Click end object Timer1: TTimer OnTimer = Timer1Timer Left = 344 Top = 8 end end
#3楼 得分:0回复于:2011-09-26 14:32:59Delphi(Pascal) code unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Label1: TLabel; Timer1: TTimer; procedure Timer1Timer(Sender: TObject); procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end;var Speed: Single = 1.0; Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject); begin Speed := 1.1; end;procedure TForm1.FormCreate(Sender: TObject); begin Timer1.Interval := 25 ; end;procedure TForm1.Timer1Timer(Sender: TObject); begin Timer1.Interval := Round(Timer1.Interval * Speed ); if Timer1.Interval > 1000 then Timer1.Enabled := False; Label1.Left := Label1.Left + 2; end;end.窗体Delphi(Pascal) codeobject Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 243 ClientWidth = 472 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object Label1: TLabel Left = 24 Top = 56 Width = 31 Height = 13 Caption = 'Label1' end object Button1: TButton Left = 32 Top = 0 Width = 75 Height = 25 Caption = 'Button1' TabOrder = 0 OnClick = Button1Click end object Timer1: TTimer OnTimer = Timer1Timer Left = 344 Top = 8 end end 这一段是什么意思?? 背景也跟着移动了
procedure TForm1.Timer1Timer(Sender: TObject); begin timer1.Interval:=round(timer1.Interval*speed); if FIndex >= FList.Count then FIndex := 0; LABEL1.Caption := FList.Strings[FIndex]; Inc(FIndex); if Timer1.Interval >1000 then Timer1.Enabled := False; end;procedure TForm1.FormCreate(Sender: TObject); begin FList := TStringList.Create; FList.LoadFromFile('e:\slw\抽奖\抽奖测试\奖项.txt'); label2.Visible:=false;end;procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char); begin speed:=1.1; if (key=#13) then if label1.Caption='谢谢参与' then begin label2.Visible:=true; end;我想做到等LABEL完全停止,然后label内容在显示出来。应该什么做,求指教?? end;end.
label同上,透明
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Speed: Single = 1.0;
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
Speed := 1.1;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
Timer1.Interval := 25 ;
end;procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer1.Interval := Round(Timer1.Interval * Speed ); if Timer1.Interval > 1000 then
Timer1.Enabled := False; Label1.Left := Label1.Left + 2;
end;end.
窗体
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 243
ClientWidth = 472
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 24
Top = 56
Width = 31
Height = 13
Caption = 'Label1'
end
object Button1: TButton
Left = 32
Top = 0
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object Timer1: TTimer
OnTimer = Timer1Timer
Left = 344
Top = 8
end
end
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Speed: Single = 1.0;
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
Speed := 1.1;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
Timer1.Interval := 25 ;
end;procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer1.Interval := Round(Timer1.Interval * Speed ); if Timer1.Interval > 1000 then
Timer1.Enabled := False; Label1.Left := Label1.Left + 2;
end;end.窗体Delphi(Pascal) codeobject Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 243
ClientWidth = 472
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 24
Top = 56
Width = 31
Height = 13
Caption = 'Label1'
end
object Button1: TButton
Left = 32
Top = 0
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object Timer1: TTimer
OnTimer = Timer1Timer
Left = 344
Top = 8
end
end
这一段是什么意思?? 背景也跟着移动了
begin
timer1.Interval:=round(timer1.Interval*speed);
if FIndex >= FList.Count then FIndex := 0;
LABEL1.Caption := FList.Strings[FIndex];
Inc(FIndex);
if Timer1.Interval >1000 then
Timer1.Enabled := False;
end;procedure TForm1.FormCreate(Sender: TObject);
begin
FList := TStringList.Create;
FList.LoadFromFile('e:\slw\抽奖\抽奖测试\奖项.txt');
label2.Visible:=false;end;procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
speed:=1.1; if (key=#13) then if label1.Caption='谢谢参与' then begin label2.Visible:=true;
end;我想做到等LABEL完全停止,然后label内容在显示出来。应该什么做,求指教??
end;end.