Delphi 在控件中添加字符滾動的消息處理功能,讓字符附著在控件內,並加上滾動的功能,Delphi初學者可參考,運行效果圖:
具體實現代碼如下:Unit1.pas代碼
01
unit Unit1;
02
interface
03
uses
04
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
05
Dialogs, StdCtrls,QExtCtrls, ExtCtrls, ScrollHint;
06
type
07
TForm1 =
class
(TForm)
08
ScrollHint1: TScrollHint;
09
Button1: TButton;
10
procedure Button1Click(Sender: TObject);
11
private
12
{ Private declarations }
13
public
14
{ Public declarations }
15
end;
16
var
17
Form1: TForm1;
18
implementation
19
{$R *.dfm}
20
procedure TForm1.Button1Click(Sender: TObject);
21
begin
22
if
button1.Caption=
'開始'
then
23
begin
24
button1.Caption:=
'停止'
;
25
scrollhint1.BeginScroll;
26
end
27
else
28
begin
29
button1.Caption:=
'開始'
;
30
scrollhint1.EndScroll;
31
end;
32
end;
33
end.
ScrollHint.pas代碼:
vIEw source