Windows 是否允许一个窗口同时带有帮助按钮和最小/最大按钮?

发布于 2024-11-08 16:41:20 字数 251 浏览 0 评论 0原文

我想在所有窗口上放置帮助按钮,如下所示:

在此处输入图像描述

但是当我将帮助按钮放入,最小化/最大化按钮消失。 Windows 是否禁止将最小/最大按钮与帮助按钮放在一起?这将令人失望,因为这意味着我只能将帮助按钮放在对话框上而不是框架上。

如果 Windows 确实禁止这样做,那么很高兴看到有关此策略的 Microsoft 官方文档。

I want to put help buttons on all my windows, like this:

enter image description here

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 技术交流群。

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

发布评论

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

评论(2

无远思近则忧 2024-11-15 16:41:20

通过设置窗口样式是不可能的。如果你真的愿意,你可以设置一些钩子,这可能会让你做你想做的事,但我不建议这样做。您可以通过发送 来模仿帮助按钮的功能WM_HELP消息。

根据 MSDN,样式 WS_MAXIMIZEBOXWS_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 and WS_MINIMIZEBOX can not be combined with WS_EX_CONTEXTHELP.

晌融 2024-11-15 16:41:20

尽管达尔伯特说的是真的,但只要付出一些努力,确实可以在窗框上正确地绘制任何东西。当然,这绝不是“官方的”,达尔伯特提到的限制仍然存在。

您可以监听 WM_NCPAINT 并在 DrawFrameControlDFC_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 of DrawFrameControl with DFC_BUTTON (which makes sure it will look like the real thing). Use WM_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.

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