不知道這些對你有否幫助
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Timer1: TTimer;
Timer2: TTimer;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
procedure WMNCHITTEST(var Msg: TWMNCHITTEST); message WM_NCHITTEST;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WMNCHITTEST(var Msg: TWMNCHITTEST);
begin
inherited;
if Msg.Result = HTCAPTION then
Msg.Result := 0
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Canvas.Font.Name := 'Times New Roman';
Canvas.Font.size := 36;
Canvas.Font.style := [fsItalic,fsBold];
Canvas.Pen.Color := clGreen;
SetBkMode( Canvas.Handle, TRANSPARENT );
Canvas.TextOut(20,40,'I love delphi');
beginpath(canvas.handle);
Canvas.TextOut(20,40,'I love delphi');
endpath(canvas.handle);
Canvas.Pen.Color := clred;
StrokePath(canvas.handle);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
S,SS :String;
Len,i :Integer;
begin
S :='I love delphi';
SS :='';
Len :=Length(S);
Canvas.Font.Name := 'Times New Roman';
Canvas.Font.size := 36;
Canvas.Font.style := [fsItalic,fsBold];
Canvas.Font.Color :=RGB(Random(255),Random(255),Random(255));
for i:=1 to Len do
begin
SetBkMode( Canvas.Handle, TRANSPARENT );
Canvas.TextOut(20,40,SS+S);
SS :=SS+S;
Sleep(100);
end;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
var
Bmp :TBitmap;
S :String;
i :Integer;
begin
S :='¨÷°_¤d°ï³·';
Bmp :=TBitmap.Create;
Bmp.Width :=Width;
Bmp.Height :=Form1.Height;
Bmp.Canvas.Brush.Color :=clBtnFace;
Bmp.Canvas.Rectangle(0,0,Bmp.Width,Bmp.Height);
SetBKMode(Bmp.Canvas.Handle,TRANSPARENT);
Bmp.Canvas.Font.Size :=72;
Bmp.Canvas.Font.Color :=RGB(Random(255),Random(255),Random(255));
Bmp.Canvas.TextOut(0,0,S);
for i :=0 to Bmp.Width-1 do
Canvas.CopyRect(Rect(0,0,i,Bmp.Height),Bmp.Canvas,Rect(0,0,i,Bmp.Height));
Bmp.Free;
end;