gpt4 book ai didi

c++ - 为什么对 BeginPaint() 的调用总是生成 WM_NCPAINT 消息?

转载 作者:可可西里 更新时间:2023-11-01 10:41:00 26 4
gpt4 key购买 nike

我在 Win32 API 上遇到了问题。我有一个程序,当它处理 WM_PAINT 消息时,它调用 BeginPaint 来剪辑区域并验证更新区域,但是 BeginPaint 函数始终生成具有相同更新区域的 WM_NCPAINT 消息,即使需要重新绘制的触摸部分仅在客户区域内。

有人知道为什么会这样吗?它位于具有 WS_CHILD 样式的子窗口上。

最佳答案

WM_PAINT 的 MSDN 条目说:

The function may also send the WM_NCPAINT message to the window procedure if the window frame must be painted and send the WM_ERASEBKGND message if the window background must be erased.

我想弄清楚为什么即使没有触及边界它也总是发送。我测试在控件内打开一个小记事本并最小化。它不触及控件的边界,只是在内部并且 BeginPaint() 生成一个 WM_NCPAINT

关于c++ - 为什么对 BeginPaint() 的调用总是生成 WM_NCPAINT 消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/100304/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com