关于系统盘图标的 popupMenu (100分)

  • 主题发起人 主题发起人 mycoolis
  • 开始时间 开始时间
M

mycoolis

Unregistered / Unconfirmed
GUEST, unregistred user!
我的那个popmenu1在点右键之后弹出,看起来挺不错的,可是跟其他程序有点不同:<br>其他程序的popupmenu弹出之后,鼠标单击桌面,就会消失;而我的单击桌面之后,还<br>巍然不动,对用户来说有些不方便,这是什么原因?我用delphi6
 
里面有一个属性可以改变其是否自动弹出和自动关闭的。不过我忘记了,可惜我现在跟<br>前没有Delphi要不然...
 
你的托盘图标用什么做的?我用TrayIcon,它的popupmenu很好的,不存在你说的情况。
 
要想自动消失关键要将本程序置于顶端,用SetForegroundWindow(Handle):<br>procedure TMainForm.ServerCallBack(var Message:TMessage);<br>Var P:TPoint;<br>begin<br>&nbsp; if (Message.LParam=WM_LBUTTONDBLCLK) then<br>&nbsp; begin<br>&nbsp; &nbsp; if (Message.WParam=IDI_Server) then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; MainForm.show;<br>&nbsp; &nbsp; end;<br>&nbsp; end;<br>&nbsp; if (Message.LParam=WM_RBUTTONDOWN) then<br>&nbsp; begin<br>&nbsp; &nbsp; if (Message.WParam=IDI_Server) then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; if not Visible then<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; SetForegroundWindow(Handle);<br>&nbsp; &nbsp; &nbsp; &nbsp; GetCursorPos(p);<br>&nbsp; &nbsp; &nbsp; &nbsp; PopupMenu.Popup(p.x, p.y);<br>&nbsp; &nbsp; &nbsp; end else<br>&nbsp; &nbsp; &nbsp; SetForegroundWindow(Handle);<br>&nbsp; &nbsp; end;<br>&nbsp; end;<br>end;
 
问题解决了,谢谢 :)<br>popup 之前先 SetForegroundWindow(Handle);
 
后退
顶部