有个思路,做个不规则窗体,以文字为边界,程序很简单,希望能用!
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls;
type
TForm2 = class(TForm)
Timer1: TTimer;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
Wi:integer;
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.DFM}
procedure TForm2.FormCreate(Sender: TObject);
var
rgn: HRGN;
Te:string;
H:integer;
begin
Canvas.Font.Name := '宋体';
Canvas.Font.Style:=[fsBold];
Canvas.Font.Size := 20;
Te:='寻人启事:dongfeg已经走失三天,望知情者通知www.delphibbs.com,面酬! ';
H:=Canvas.TextHeight(' ');
Wi:=Canvas.TextWidth(Te);
left:=screen.Width;
top:=screen.Height -H-50;
Width:=Wi;
Color:=clBlue;
FormStyle:=fsStayOnTop;
BeginPath(Canvas.Handle);
SetBkMode(Canvas.Handle, TRANSPARENT);
Canvas.TextOut(20, 20, Te);
EndPath(Canvas.Handle);
rgn := PathToRegion(Canvas.Handle);
SetWindowRgn(Handle, rgn, true);
Timer1.Interval:=50;
Timer1.Enabled :=true;
end;
procedure TForm2.Timer1Timer(Sender: TObject);
begin
left:=left-1;
if left<Wi*(-1) then
begin
Timer1.Enabled :=false;
Visible:=false;
left:=screen.Width;
Visible:=true;
Timer1.Enabled :=true;
end;
end;
end.