在客户区外绘图,winAPI
我如何在窗口的客户区之外和标题栏上绘制。我知道这是可以做到的,但我不确定如何有效地实施这一点。想想谷歌浏览器,标签位于标题栏上。
How would I draw outside the client area of a window, and on the title bar. I know it can be done, but I am unsure of how to implement this effectively. Think google chrome, where the tabs are on the title bar.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当 Windows 要求您绘制窗口中超出客户区域的部分时,它会向您发送一个 WM_NCPAINT 消息。处理该消息并绘制您想要的窗口非客户端部分。请参阅我链接的页面,了解如何获取可以利用的设备上下文的示例。
When Windows asks you to draw the portion of the window that is outside your client area, it will send you an WM_NCPAINT message. Handle that message and draw whatever you want the non-client portion of your window to be. See the page I linked for an example of how to get a device context you can draw upon.
可能还值得一提 WM_NCHITTEST ,如果您计划自定义非客户端元素的位置。
It may be worth mentioning WM_NCHITTEST also, if you plan on customizing where non-client elements are located.
绘制自定义窗口标题 DrawCaption
Drawing a custom window caption DrawCaption