471,354 Members | 1,422 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

How to show a ContextMenuStrip without displaying at taskbar?

I am writing a NotifyIcon app.
I want to use Left mouse click to pop up a ContextMenuStrip.

Currently, I use
ContextMenuScrip.Show(x,y) to display it.
But it always show a windows at taskbar like I popup a window form.

Did I use the wrong method?

Se*********@hotmail.com

27th,Dec
Dec 27 '05 #1
2 4385
Anyone notice my problem?
Any help is appreciated.

"Seraph Jiang" <Se*********@gmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I am writing a NotifyIcon app.
I want to use Left mouse click to pop up a ContextMenuStrip.

Currently, I use
ContextMenuScrip.Show(x,y) to display it.
But it always show a windows at taskbar like I popup a window form.

Did I use the wrong method?

Se*********@hotmail.com

27th,Dec

Dec 28 '05 #2
I had the same problem. I could not find a way to achieve this without
using Reflection. This won't be officially supported, since it uses a
private method on the NotifyIcon class, but here's what I did (using an
anonymous method):

niMain.MouseClick += delegate( object sender, MouseEventArgs e )
{
if ( e.Button != MouseButtons.Right )
{
niMain.GetType().InvokeMember(
"ShowContextMenu",

BindingFlags.InvokeMethod|BindingFlags.Instance|Bi ndingFlags.NonPublic,
null,
niMain,
null
);
}
};

Jan 5 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jake | last post: by
reply views Thread by Viper | last post: by
1 post views Thread by =?Utf-8?B?QnJhZA==?= | last post: by
2 posts views Thread by fniles | last post: by
9 posts views Thread by =?Utf-8?B?Z2luYWNyZXNzZQ==?= | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.