防止在C ++中重新绘制窗口 [英] Prevent repainting of window in C++

查看:194
本文介绍了防止在C ++中重新绘制窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写一个全局钩子DLL,需要做一些绘图使用GDI +窗口响应事件。我的问题是,正在绘制的窗口保持自己重画,所以我画的是在我想要之前擦除。有什么办法,我可以阻止窗口绘画任何东西只要我需要?

I am writing a global hook DLL that needs to do some drawing using GDI+ on a window in response to an event. My problem is that the window that is being drawn keeps repainting itself, so what I draw gets erased before I want it to. Is there any way I can prevent the window from painting anything for as long as I need to?

我的钩子目前是一个 WH_CALLWNDPROC hook。绘图是使用GDI +响应消息 WM_SIZING 完成的。我使用GDI +绘制到窗口的 DC (即 GetWindowDC )。我绘制的是正确绘制,但几乎立即擦除窗口客户端区域重画。创建我正在绘制的窗口的程序是记事本。

My hook currently is a WH_CALLWNDPROC hook. The drawing is done using GDI+ in response to the message WM_SIZING. I drawing using GDI+ onto the window's DC (i.e. GetWindowDC). What I am drawing is drawn correctly, but gets erased almost instantly as the window client area gets repainted. The program that created the window I am drawing on is Notepad. As the cursor blinks, what I have drawn gets erased.

有人知道我可以暂时暂停窗口的绘画吗?

Does anyone know of a way I can temporarily suspend painting of the window?

谢谢!

推荐答案

我建议把你的图形放在一个分层的窗口重叠的目标窗口。这似乎是最干净的方式。毕竟,在某种程度的概念,这是窗口经理的目的:)

I would suggest putting your graphics in a layered window overlapping the target window. That seems to be the cleanest way. After all, at some level of conception, this is the purpose of the window manager :)

这篇关于防止在C ++中重新绘制窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆