一个文本内容在label中滚动,当我按下停止时,time缓慢的停止,就是文本的内容慢慢的挺下来,这个要怎么实现,求高手解答。。

解决方案 »

  1.   

    设一个自增变量i,可以用一个label和panle组合实现,通常label 从panel顶移到panel底,然后重新回到顶端,移动写在timer里,位置移动变量i,点击停止后i自减,也就是看起来移动速度慢了,方法不便,一直到i小于某个数值后,label不再移动停在panel中央,i重置,timer停止,搞定
      

  2.   

    panel为一个label大小,无边框
    label同上,透明
      

  3.   


    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
      

  4.   

     #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 
     这一段是什么意思?? 背景也跟着移动了
      

  5.   

    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.