c++重新粉刷窗户的一部分
我知道如何重新绘制整个窗口,但我不知道如何重新绘制一块窗口,就像我使用 gdi+ 绘制一个正方形一样,而不是我想更改它的坐标,所以我想重新绘制正方形而不是整个窗口
有什么想法吗?
i also tried this
RECT rect2;
rect2.left=0;
rect2.top=100;
rect2.right=225;
rect2.bottom=300;
InvadiateRect(hwnd, &rect2, false);
它仍然重新粉刷整个窗口
i know how to repaint the full window but i don't know how to repaint a pieace of window like i draw a squre using gdi+ than i want to change it's coordinates so i want to repaint the squre not the whole window
anyidea?
i also tried this
RECT rect2;
rect2.left=0;
rect2.top=100;
rect2.right=225;
rect2.bottom=300;
InvadiateRect(hwnd, &rect2, false);
it still repaint the whole window
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实现此目的的一种方法是使用一个足够大的矩形来调用
InvalidateRect()
,该矩形足以覆盖您移动的方块的新旧位置。然后,Windows 将调用您的WM_PAINT
处理程序来重新绘制已更改的屏幕区域。UnionRect()
函数有助于计算此重绘矩形。One way to do this is to call
InvalidateRect()
with a rectangle that is large enough to cover both the old and new positions of the square you moved. Windows will then call yourWM_PAINT
handler to repaint the area of the screen that changed.The
UnionRect()
function is helpful for calculating this repaint rectangle.