Delphi中如何实现滚动文字

1、先添加一个Timer控件,其Interval属性设置为50。

2、再添加一个Label控件,Name为Label1。

3、然后在Timer的OnTimer事件添加如下代码:

 1 unit Unit13;
 2 
 3 interface
 4 
 5 uses
 6   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 7   Dialogs, StdCtrls, ExtCtrls, jpeg;
 8 
 9 type
10   TForm13 = class(TForm)
11     Timer1: TTimer;
12     Label1: TLabel;
13     Image1: TImage;
14     procedure Timer1Timer(Sender: TObject);
15   private
16     { Private declarations }
17   public
18     { Public declarations }
19   end;
20 
21 var
22   Form13: TForm13;
23 
24 implementation
25 
26 {$R *.dfm}
27 
28 procedure TForm13.Timer1Timer(Sender: TObject);
29 begin
30   Self.Label1.Left := Self.Label1.Left - 1 ;
31   if Self.Label1.Left + Self.Label1.Width = 0 then
32   Self.Label1.Left := Form13.Width;
33 
34 end;
35 
36 end.

效果图:

 

posted on 2013-07-17 19:51  向北方 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/China3S/p/3196529.html

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值