本文介绍了如何在 win32/mfc 应用程序中隐藏/折叠主菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直对如何实现这一点很感兴趣(使用 alt 键隐藏/显示主菜单),现在一些应用程序经常这样做.真正让我满意的是带有这个插件的 Visual Studio 2010:http://visualstudiogallery.msdn.microsoft.com/bdbcffca-32a6-4034-8e89-c31b86ad4813?SRC=VSIDE

I always been interested on how we can accomplish this (hide/show the main menu using the alt key), and now some applications do this very often. One that really please me is the visual studio 2010 with this plugin:http://visualstudiogallery.msdn.microsoft.com/bdbcffca-32a6-4034-8e89-c31b86ad4813?SRC=VSIDE

(firefox 也这样做,但我认为这是一种不同的方式)

(firefox also do this, but i think that is in a different way)

谁能向我解释如何实现这一点,或者您是否知道任何示例项目可以证明这一点,请告诉我.

Can anyone explain me how this can be achieved or if you known of any sample project that demonstrate this please tell me.

(我在堆栈中的一些回复中看到的是,我们必须在隐藏菜单时销毁菜单并在显示时创建菜单?!但这似乎有点糟糕的解决方案......)

(what i can see in some replies here in stack is that we have to destroy the menu when is to hide and create it when is to show?! but this seems a bit bad solution...)

谢谢

推荐答案

SetMenu 函数允许您从窗口添加/删除菜单.它不会破坏菜单.

The SetMenu function lets you add/remove the menu from the window. It does not destroy the menu.

请注意,大多数具有动态菜单隐藏/显示行为的应用程序并未真正显示菜单.他们展示了一个看起来像菜单的自定义控件.

Note that most applications which have the dynamic menu hide/show behavior are not really showing a menu. They're showing a custom control that looks like a menu.

这篇关于如何在 win32/mfc 应用程序中隐藏/折叠主菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 08:39