0

I'm trying to make a program that basically is a ContextMenuStrip, where users can add their own shortcuts and so on and access the menu by pressing a hotkey combination.

The way I make the menu appear is by giving the main form 0% opacity, but if there is another way, please let me know.

My wish is to make something like this, just a lot more customizable and user-friendly: http://www.bullzip.com/products/exm/info.php

So far I've had a couple of problems: - When the menu is first shown, everything works fine, but when I try pressing the hotkey again, the menu appears, but so does a "blank" window in the taskbar. - Again, when the menu is first shown, everything is fine, but when clicking anywhere else than on the menu, it won't close again. The only way to close it, is by selecting something from the menu.

Hopefully some of you can point me in the direction of a solution :)

Thank you in advance!

  • What kind of application (WebForms, WPF, etc)? Why do you need a main form if you're only showing a menu? – Jonathan Wood Mar 03 '11 at 20:08
  • It's WinForms. And how can I make an application without a main form and only show the menu? Btw, I'm going to make it accessible through a NotifyIcon (for editing the menu and so on) – Neo3000 Mar 03 '11 at 20:33
  • 1
    You lost me at making something visible by setting opacity to 0. The question makes little sense and is unanswerable. – Hans Passant Mar 03 '11 at 20:52
  • Well, take a look at http://bullzip.com/products/exm/info.php - And read my two problems, then you should understand.. – Neo3000 Mar 03 '11 at 20:54

1 Answers1

0
Form.ShowInTaskbar = false;

Form.WindowState = FormWindowState.Minimized;

This should hide the form for you.

Then use the following to trap key presses.

protected override bool ProcessCmdKey(ref Meassage msg, Keys keyData)
{
    if(keydata == whatever)
    {
        contextmenustrip.Show();
    }    

    return true; //false if you want to suppress the key press.
}
WillDud
  • 347
  • 1
  • 14
  • I already set these properties, but it doesn't work.. It still opens in the taskbar and doesn't close on lost focus. – Neo3000 Mar 03 '11 at 21:14
  • Yeah, well that requires the form to be shown and it isn't a global hotkey - I already made this.. My problem is that it won't hide when clicking on something else and that it shows in the taskbar, eventhough all the settings for it is (as far as I know) set properly. – Neo3000 Mar 03 '11 at 21:24