C ++ WM

编程入门 行业动态 更新时间:2024-10-25 02:19:37
本文介绍了C ++ WM_NCCALCSIZE未发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

经过一些研究,我发现我必须处理WM_NCCALCSIZE消息,因此我试图将文本垂直放置在编辑控件中. 因此,我将编辑控件归为子类,但是WM_NCCALCSIZE消息从未发送.

I'm trying to center the text in a edit control vertically, after some research I found I have to process the WM_NCCALCSIZE message. So i've subclassed my edit control, but the WM_NCCALCSIZE message is never sent.

我做错什么了吗?

所以我正在很好地处理WM_NCCALCSIZE消息,并且我通过将WS_EX_CLIENTEDGE传递给CreateWindowEx创建了3d边框. 但是,如果我通过杀死主题服务禁用Windows主题,则处理WM_NCCALCSIZE消息的控件上的边框将消失. 另一个不处理WM_NCCALCSIZE消息的控件仍然具有正常的边框.

So i'm processing the WM_NCCALCSIZE message fine, and I have a 3d border created by passing WS_EX_CLIENTEDGE to CreateWindowEx. But if I disable windows themes by killing the theme service, the border goes away on the control thats processing the WM_NCCALCSIZE message. Another control that doesnt process the WM_NCCALCSIZE message still has the border like normal.

所以我假设我应该在WM_NCCALCSIZE中做些什么让我保持边界?如果是这样,该怎么办?如果没有任何办法找回边界?

So i'm assuming I'm supposed to be doing somethign in WM_NCCALCSIZE that allows me to keep the border? If so what? if not any way to get the border back?

推荐答案

弄清楚了,WM_NCCALCSIZE是在子类化编辑控件之前发送的. 所以我不得不超类EDIT类.

Figured it out, WM_NCCALCSIZE is sent before the edit control is subclassed. So i had to superclass the EDIT class.

我刚刚想到的另一种解决方案是将其子类化,然后用SWP_FRAMECHANGED调用SetWindowPos,这将导致其发送WM_NCCALCSIZE消息.

Another solution I just thought of would be to subclass it, then call SetWindowPos with SWP_FRAMECHANGED, this causes it to send the WM_NCCALCSIZE message.

如果有人对为什么一种方法优于另一种方法有任何意见,请发表评论:)

If anyone has any opinions why one method would be better then the other, please comment :)

更多推荐

C ++ WM

本文发布于:2023-11-16 23:11:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1607884.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:WM

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!