c++重新粉刷窗户的一部分

发布于 2024-09-16 00:57:00 字数 294 浏览 2 评论 0原文

我知道如何重新绘制整个窗口,但我不知道如何重新绘制一块窗口,就像我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

饭团 2024-09-23 00:57:01

实现此目的的一种方法是使用一个足够大的矩形来调用 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 your WM_PAINT handler to repaint the area of the screen that changed.

The UnionRect() function is helpful for calculating this repaint rectangle.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文