How to show a ContextMenuStrip without displaying at taskbar?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Seraph Jiang

    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 ContextMenuStri p.

    Currently, I use
    ContextMenuScri p.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?

    SeraphJiang@hot mail.com

    27th,Dec


  • Seraph Jiang

    #2
    Re: How to show a ContextMenuStri p without displaying at taskbar?

    Anyone notice my problem?
    Any help is appreciated.

    "Seraph Jiang" <SeraphJiang@gm ail.com> wrote in message
    news:%239YPsZrC GHA.2356@tk2msf tngp13.phx.gbl. ..[color=blue]
    >I am writing a NotifyIcon app.
    > I want to use Left mouse click to pop up a ContextMenuStri p.
    >
    > Currently, I use
    > ContextMenuScri p.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?
    >
    > SeraphJiang@hot mail.com
    >
    > 27th,Dec
    >
    >[/color]


    Comment

    • RichardH

      #3
      Re: How to show a ContextMenuStri p without displaying at taskbar?

      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.MouseCli ck += delegate( object sender, MouseEventArgs e )
      {
      if ( e.Button != MouseButtons.Ri ght )
      {
      niMain.GetType( ).InvokeMember(
      "ShowContextMen u",

      BindingFlags.In vokeMethod|Bind ingFlags.Instan ce|BindingFlags .NonPublic,
      null,
      niMain,
      null
      );
      }
      };

      Comment

      Working...