GetWindowRect 未正确给出左值和顶部值
GetWindowRect is not giving left and top values correctly
本文关键字:顶部 GetWindowRect 更新时间:2023-10-16
我正在尝试更改我的窗口背景,但函数 GetWindowRect 没有正确获取左侧和顶部值。FillRect 函数仅填充屏幕的四分之一,其余部分保持透明。当我手动设置左侧和顶部值时,它可以正常工作,填满整个窗口。
case WM_ERASEBKGND:{
hdc = BeginPaint(hwnd, &ps);
RECT rect;
GetWindowRect(hwnd, &rect);
rect.left = 0; //It only works
rect.top = 0; //if I do this
FillRect(hdc, &rect, CreateSolidBrush(RGB(240,240,240));
EndPaint(hwnd, &ps);
}
break;
正如@Richard Critten建议的那样,使用GetClientRect()
.GetWindowRect()
返回窗口的屏幕坐标,而GetClientRect()
返回呈现应用程序图形的窗口中工作区的坐标。
相关文章:
- 程序顶部的声明与定义(最佳实践)
- 顶部带有搜索框的组合框
- 在Visual Studio中单实例Qt应用程序版本5.11.1中,在所有其他窗口的顶部打开Qt MainWindow
- GetWindowRect 未正确给出左值和顶部值
- 如何在C++中更改堆栈的顶部?
- 嵌套容器:为什么我无法访问堆栈队列顶部的堆栈?C++
- 斯塔克,堆栈,也可以在底部和顶部添加整数
- 在矢量中使用擦除时双重释放或损坏(快速顶部).如何擦除一个矢量的几个项目知道它们的索引?
- 如何实现唯一 id 队列,其中元素可以在 C++ 中"bumped"到顶部?
- 动态构造函数中的新字符 [] 抛出"损坏的顶部大小";
- 无法获取已填充堆栈<char>的顶部元素
- GetWindowRect()返回的大小小于游戏的实际可见窗口的可能原因是什么
- 如何返回堆栈 c++ 中顶部对象的引用
- 将 1 居中放在顶部
- 如何在不使用循环的情况下回到代码的顶部?
- C++ 入门加列表:10.9 "顶部"指针问题
- 如何将项目弹出堆栈中顶部项目下方?
- OpenCv 边框顶部和左侧 OpenGL 帧 c++
- 如何为我的窗户腾出顶部空间?
- Qt:模拟来自顶部父小部件的 QMouseButtonPress 事件