Windows 是否允许一个窗口同时带有帮助按钮和最小/最大按钮?
我想在所有窗口上放置帮助按钮,如下所示:
但是当我将帮助按钮放入,最小化/最大化按钮消失。 Windows 是否禁止将最小/最大按钮与帮助按钮放在一起?这将令人失望,因为这意味着我只能将帮助按钮放在对话框上而不是框架上。
如果 Windows 确实禁止这样做,那么很高兴看到有关此策略的 Microsoft 官方文档。
I want to put help buttons on all my windows, like this:
But when I put the help button in, the minimize/maximize buttons disappear. Does Windows forbid having the min/max buttons together with the help buttons? That would be disappointing because that would mean I could put the help button only on dialogs and not on frames.
If Windows does forbid this, it would be nice to see an official Microsoft document which talks about this policy.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通过设置窗口样式是不可能的。如果你真的愿意,你可以设置一些钩子,这可能会让你做你想做的事,但我不建议这样做。您可以通过发送 来模仿帮助按钮的功能
WM_HELP
消息。根据 MSDN,样式
WS_MAXIMIZEBOX
和WS_MINIMIZEBOX
不能与WS_EX_CONTEXTHELP
组合使用。It is not possible through setting windows styles. If you really wanted to you could set some hooks that would probably let you do what you want, but I would not recommend doing that. You can mimic the functionality of the help button by sending the
WM_HELP
message.According to MSDN, the styles
WS_MAXIMIZEBOX
andWS_MINIMIZEBOX
can not be combined withWS_EX_CONTEXTHELP
.尽管达尔伯特说的是真的,但只要付出一些努力,确实可以在窗框上正确地绘制任何东西。当然,这绝不是“官方的”,达尔伯特提到的限制仍然存在。
您可以监听
WM_NCPAINT
并在DrawFrameControl
和DFC_BUTTON
的帮助下自己绘制按钮(这确保它看起来像真实的东西) 。使用WM_NCHITTEST
和朋友 (WM_NC*BUTTON*
) 来查明您绘制的按钮是否被点击。所以,是的,从技术上讲是可以实现你想要的,但通常不值得付出额外的努力。
只是想将其记录下来以保证完整性。
Although it is true what daalbert says, with some effort it is indeed possible to draw just about anything properly on the window frame. Of course this is in no way "official" and the limitation that daalbert mentions still stands.
You can listen for
WM_NCPAINT
and draw the button yourself with the help ofDrawFrameControl
withDFC_BUTTON
(which makes sure it will look like the real thing). UseWM_NCHITTEST
and friends (WM_NC*BUTTON*
) to find out whether the button you draw gets clicked.So yes, it's technically possible to achieve what you want but usually not worth the extra effort.
Just wanted to have this on record for completeness.