如何做像SayTheTime一样能够覆盖右下面时间的长条型TrayICon(100分)

  • 主题发起人 主题发起人 snowvalley
  • 开始时间 开始时间
S

snowvalley

Unregistered / Unconfirmed
GUEST, unregistred user!
如何做像SayTheTime一样能够覆盖右下面时间的长条型TrayICon,各位老大献技献策啊。
 
我想这个能符合你的要求把!不过可显示的字数有限制,没办法就那么大地方。<br><br>unit Unit2;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br>&nbsp; Dialogs, StdCtrls, ExtCtrls;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; &nbsp; Button1: TButton;<br>&nbsp; &nbsp; Panel1: TPanel;<br>&nbsp; &nbsp; Timer1: TTimer;<br>&nbsp; &nbsp; procedure Button1Click(Sender: TObject);<br>&nbsp; &nbsp; procedure Timer1Timer(Sender: TObject);<br>&nbsp; &nbsp; procedure FormCreate(Sender: TObject);<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br>&nbsp; t:SYSTEMTIME;<br><br>implementation<br><br>{$R *.dfm}<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>&nbsp; th:hwnd;<br>&nbsp; r:trect;<br>&nbsp; dc:hdc;<br>begin<br>&nbsp; th:=FindWindowEx(FindWindowEx(FindWindow('Shell_TrayWnd',nil),0,'TrayNotifyWnd',nil),0,'TrayClockWClass',nil);<br>&nbsp; getwindowrect(th,r);<br>&nbsp; windows.setparent(panel1.Handle,th);<br>&nbsp; MoveWindow(panel1.Handle,0,0,r.Right-r.Left,r.Bottom-r.Top,true);<br>end;<br><br>procedure TForm1.Timer1Timer(Sender: TObject);<br>begin<br>&nbsp; getlocaltime(t);<br>&nbsp; panel1.Caption:='My '+inttostr(t.wHour)+':'+inttostr(t.wMinute);<br>// &nbsp;panel1.Hint:=inttostr(t.wYear)+'年'+inttostr(t.wMonth)+'月'+inttostr(t.wDay)+'日';<br>end;<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>begin<br>&nbsp; getlocaltime(t);<br>&nbsp; panel1.Caption:=inttostr(t.wHour)+':'+inttostr(t.wMinute);<br>// &nbsp;panel1.Hint:=inttostr(t.wYear)+'年'+inttostr(t.wMonth)+'月'+inttostr(t.wDay)+'日';<br>end;<br><br>end.
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
后退
顶部