花15分钟写了个demo, 运行起来就会在你的桌面当中出现一个庞大的红色数字时钟。 应该就是你要求的效果了。
pas文件:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Timer1Timer(Sender: TObject);
var
s: string;
r, r1: HRGN;
Rct: TRect;
begin
s := formatdatetime('yyyy-mm-dd hh:nn:ss', now);
begin
path(canvas.handle);
textout(canvas.handle, 0, 0, pchar(s), length(s));
endpath(canvas.handle);
r1 := pathtoregion(canvas.handle);
getrgnbox(r1, rct);
r := createrectrgnindirect(rct);
combinergn(r, r, r1, RGN_DIFF);
deleteobject(r1);
setwindowrgn(handle, r, true);
end;
end.
dfm文件:
object Form1: TForm1
Left = 176
Top = 288
BorderStyle = bsNone
Caption = 'Form1'
ClientHeight = 109
ClientWidth = 688
Color = clRed
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -64
Font.Name = 'Times New Roman'
Font.Style = [fsBold]
OldCreateOrder = False
Position = poScreenCenter
PixelsPerInch = 96
TextHeight = 73
object Timer1: TTimer
OnTimer = Timer1Timer
Left = 152
Top = 88
end
end