用鼠标左键单击notifyIcon上的显示菜单?

问题描述:

我的应用在系统托盘中有一个通知图标。我希望鼠标左键单击

启动菜单,然后单击鼠标右键执行其他操作。通常,

为一个按钮,我会听MouseDown,如果我需要显示

菜单,我会将contextMenu.Show(buttonCtrl,new Point(0)) 。但是对于notifyIcon,我不能这样做,因为notifyIcons不是控件。我怎么能用
显示一个contextMenu,光标只按命令显示?


-mdb

My app has a notify icon in the systray. I want the left mouse click to
initiate a menu, and a right-mouse click to do something else. Normally,
for a button, I would listen to MouseDown and if I need to display the
menu, I would contextMenu.Show(buttonCtrl, new Point(0)). But I can''t do
this for a notifyIcon because notifyIcons aren''t controls. How can I
display a contextMenu where the cursor is by command only?

-mdb

很遗憾你不能这样做。但是你可以处理

通知图标的点击事件并显示你自己的上下文菜单..但是很难

控制菜单的位置以及何时隐藏菜单。 ...


-


谢谢,

Yunus Emre ALP?ZEN

BSc,MCAD.NET

" mdb" < m_b_r_a_y @ c_t_i_u_s_a__d0t__com>在消息中写道

news:Xn **************************** @ 207.46.248.16。 ..
Unfortunately you can not do this. But you can handle click events for
notify icon and show your own contextr menu.. But it could be hard to
control position of the menu and when to hide menu....

--

Thanks,
Yunus Emre ALP?ZEN
BSc, MCAD.NET

"mdb" <m_b_r_a_y@c_t_i_u_s_a__d0t__com> wrote in message
news:Xn****************************@207.46.248.16. ..
我的应用程序在系统托盘中有一个通知图标。我希望鼠标左键单击以启动菜单,并单击鼠标右键以执行其他操作。通常,对于一个按钮,我会听MouseDown,如果我需要显示
菜单,我会将contextMenu.Show(buttonCtrl,new Point(0))。但是我不能为notifyIcon做这个,因为notifyIcons不是控件。我怎样才能只显示光标所在的contextMenu?

-mdb
My app has a notify icon in the systray. I want the left mouse click to
initiate a menu, and a right-mouse click to do something else. Normally,
for a button, I would listen to MouseDown and if I need to display the
menu, I would contextMenu.Show(buttonCtrl, new Point(0)). But I can''t do
this for a notifyIcon because notifyIcons aren''t controls. How can I
display a contextMenu where the cursor is by command only?

-mdb



mdb写道:
我的应用在系统托盘中有一个通知图标。我希望鼠标左键单击以启动菜单,并单击鼠标右键以执行其他操作。通常,对于一个按钮,我会听MouseDown,如果我需要显示
菜单,我会将contextMenu.Show(buttonCtrl,new Point(0))。但是我不能为notifyIcon做这个,因为notifyIcons不是控件。我怎样才能只显示光标所在的contextMenu?

-mdb
My app has a notify icon in the systray. I want the left mouse click to
initiate a menu, and a right-mouse click to do something else. Normally,
for a button, I would listen to MouseDown and if I need to display the
menu, I would contextMenu.Show(buttonCtrl, new Point(0)). But I can''t do
this for a notifyIcon because notifyIcons aren''t controls. How can I
display a contextMenu where the cursor is by command only?

-mdb





通知图标有一个上下文菜单属性。

创建上下文菜单,然后在设计时(或运行时)将该菜单与您的通知

图标关联,它将自动生成弹出。


HTH

JB


Hi,
The notify Icon has a context menu property.
Create your context menu and then associate that menu with your notify
icon at design time (or run time) and it will automagically pop up.

HTH
JB


" Wayne" &LT;我****** @ community.nospam&GT;在新闻中写道:ODM18bYVFHA.1796

@ TK2MSFTNGP15.phx.gbl:
"Wayne" <Me******@community.nospam> wrote in news:ODM18bYVFHA.1796
@TK2MSFTNGP15.phx.gbl:
我还在想你为什么要更改默认标准
I''m still wondering why you would want to change the default standard
behavior. Depending on why I would find using your app very annoying and
probably uninstall it.




首先,它的设计考虑因素不应该关心任何人

但我和我的客户。他们中的许多人表示他们希望点击鼠标左键显示

菜单,因为这是主要的

功能。该计划。他们希望在右键单击

时出现一个窗口,因为这是一个辅助功能。该计划。


其次,我不打算强迫任何人 - 这将是一个

选项。如果你想要它的方式,那很好。但问题仍然存在,我不能做他们要求我做的事情,这就是为什么我在这里寻找帮助的b $ b。


-mdb



Well first of all, its a design consideration that shouldn''t concern anyone
but me and my customers. Many of them have expressed that they want the
menu to appear on the left mouse click, because this is the "primary
function" of the program. They want a window to appear when a right-click
occurs because this is a "secondary function" of the program.

Second of all, I''m not planning to force this on anyone - it will be an
option. If you want it the way you want it, fine. But the problem still
exists that I can''t do what they are asking me to do, which is why I''m
looking for some help here.

-mdb