TrayIcon托盘图标控件很多第三方控件里面都有,今天我们来看下JVCL的。
功能很多,这里只看下常用的几个功能。
1、需要拖入JvTrayIcon与PopupMenu控件
2、不需要太多复杂的功能,咱就需要一个关闭程序(或最小化)到托盘、托盘带右键菜单、双击托盘显示程序、最后可能还需要一个气泡提示!
测试代码:
procedure TForm1.JvTrayIconUpdate;
var
Options:TTrayVisibilities;
begin
with JvTrayIcon1 do
begin
Active := false;
IconIndex := -1;
Hint := '这里是一个提示';
Options := [];
//Include(Options,tvAutoHide);
//Include(Options,tvAutoHideIcon);
Visibility := Options;
Active := True;
end;
end;
procedure TForm1.N1Click(Sender: TObject);
begin
showOrHide;
end;
procedure TForm1.N2Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TForm1.JvTrayIcon1DblClick(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
showOrHide;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
JvTrayIconUpdate;
en