红鱼儿

uniGUI运行期加载网站图标
procedure TuniServerModule.UniGUIServerModuleBeforeInit(Sender: TObject);
begin

  if FileExists(Self.StartPath + 'favicon.ico') then
    Self.Favicon.LoadFromFile(Self.StartPath + 'favicon.ico');


end;

一定要在ServerModule.BeforeInit事件中实现,在OnCreate中是无效的。

下面是浏览器的截图,用上面的代码,正确显示了图标:

 当然,也可以在设计期,静态的设置uniServerModule.Favicon属性,定义图标。我完全是因为多个项目共用一个uniServerModule,才需要运行期加载图标。

 

posted on 2025-03-27 16:31  红鱼儿  阅读(123)  评论(0)    收藏  举报