CnPack Forum


 
Subject: CnTrayIcon.pas的ShowApplication恢复仍然有问题
yinsim
新警察
Rank: 1



UID 50783
Digest Posts 0
Credits 48
Posts 16
点点分 48
Reading Access 10
Registered 2010-8-17
Status Offline
Post at 2012-6-6 11:13  Profile | Blog | P.M. 
CnTrayIcon.pas的ShowApplication恢复仍然有问题

新建一工程,加入CnTrayIcon控件, AutoHide=True; UseAppIcon=True,其余默认,为双击添加如下事件:

procedure TForm1.CnTrayIconDblClick(Sender: TObject);
begin
  if Application.MainForm.WindowState = wsMinimized then
    CnTrayIcon.ShowApplication
  else
    CnTrayIcon.HideApplication;
end;

在Windows XP/7/2008下面都无法正常还原窗口,表现为最小化的任务栏图标,需要鼠标再次点击才能恢复.

CnPack是否可以考虑在CnTrayIcon.pas添加多一行Application.BringToFront?

procedure TCnTrayIcon.ShowApplication;
begin
  ShowWindow(Application.Handle, SW_SHOW);
  Application.Restore;
  if Application.MainForm <> nil then
  begin
    if FSaveWindowState <> wsMinimized then
      Application.MainForm.WindowState := FSaveWindowState
    else
      Application.MainForm.WindowState := wsNormal;
    Application.MainForm.Show;
    Application.BringToFront;
  end;
end;

Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6626
Posts 3492
点点分 6626
Reading Access 102
Registered 2004-3-28
Status Online
Post at 2012-6-15 09:56  Profile | Blog | P.M. 
楼主在加了Application.BringToFront;后是否此问题就修复了?
Top
 




All times are GMT++8, the time now is 2021-4-13 17:51

    本论坛支付平台由支付宝提供
携手打造安全诚信的交易社区 Powered by Discuz! 5.0.0  © 2001-2006 Comsenz Inc.
Processed in 0.007812 second(s), 7 queries , Gzip enabled

Clear Cookies - Contact Us - CnPack Website - Archiver - WAP