展现出的ContextMenuStrip没有它显示在任务栏

人气:1,094 发布:2022-09-10 标签: .net winforms c++

问题描述

我发现,当我一个的ContextMenuStrip执行show()方法(右键菜单),如果位置之外,它属于形式的,它显示在任务栏也。

I have found that when I execute the show() method for a contextmenustrip (a right click menu), if the position is outside that of the form it belongs to, it shows up on the taskbar also.

我想创建的NotifyIcon的,当点击了右键菜单,但菜单悬停系统托盘上面,而不是形式的内部(如表格可以被最小化时,单击鼠标右键),它显示在任务酒吧一些奇怪的原因

I am trying to create a right click menu for when clicking on the notifyicon, but as the menu hovers above the system tray and not inside the form (as the form can be minimised when right clicking) it shows up on the task bar for some odd reason

下面是我的code目前:

Here is my code currently:

private: System::Void notifyIcon1_MouseClick(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {

if(e->Button == System::Windows::Forms::MouseButtons::Right) {

    	this->sysTrayMenu->Show(Cursor->Position);

    }
}

还有什么其他的选择,我需要设定,因此它不会出现在任务栏上的一个空白的过程。

What other options do I need to set so it doesn't show up a blank process on the task bar.

推荐答案

尝试分配你的菜单中的NotifyIcon的ContextMenuStrip属性,而不是显示它在鼠标点击的处理程序。

Try assigning your menu to the ContextMenuStrip property of NotifyIcon rather than showing it in the mouse click handler.

476