C# - 独立 ContextMenuStrip - 一些挫折

发布于 2024-10-19 22:29:12 字数 455 浏览 8 评论 0原文

我正在尝试制作一个基本上是 ContextMenuStrip 的程序,用户可以在其中添加自己的快捷方式等,并通过按热键组合来访问菜单。

我使菜单出现的方法是给主窗体 0% 不透明度,但如果有其他方法,请告诉我。

我的愿望是做这样的事情,只是更加可定制和用户友好: http://www.bullzip.com/products/exm/info.php

到目前为止我遇到了几个问题: - 首次显示菜单时,一切正常,但当我尝试再次按热键时,菜单出现,但任务栏中出现“空白”窗口。 - 同样,当菜单第一次显示时,一切都很好,但是当单击菜单上的其他位置时,它不会再次关闭。关闭它的唯一方法是从菜单中选择某些内容。

希望你们中的一些人能给我指出解决方案的方向:)

提前谢谢您!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沙沙粒小 2024-10-26 22:29:12
Form.ShowInTaskbar = false;

Form.WindowState = FormWindowState.Minimized;

这应该会为您隐藏表单。

然后使用以下方法捕获按键。

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.
}
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.
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文