在畫面上放置
1 ApplicationEvents
2 TrayIcon
3 PopupMenu
然後在ApplicationEvents1Minimize寫上
[pascal]
Hide();
WindowState := wsMinimized;
TrayIcon1.Visible := True;
TrayIcon1.Animate := True;
TrayIcon1.ShowBalloonHint;
[/pascal]
接著在TrayIcon的Click事件讓popupmenu顯示
[pascal]
var
p : TPoint;
begin
GetCursorPos(p);
popupmenu1.Popup(p.X,p.Y);
end;
[/pascal]
最後在popupmenu上的onclick加上
[pascal]
Show;
WindowState := wsMaximized;
trayicon1.Visible := False;
[/pascal]