开发者

MFC window maximized, but to wrong top coordinate

开发者 https://www.devze.com 2023-02-13 01:15 出处:网络
Sometimes, when I use ShowWindow(SW_SHOWMAXIMIZED), my MFC window is maximized, but it is not positioned at coordinates (0, 0), as it should, it is moved down, for around 30-40 pixels. Any tip on what

Sometimes, when I use ShowWindow(SW_SHOWMAXIMIZED), my MFC window is maximized, but it is not positioned at coordinates (0, 0), as it should, it is moved down, for around 30-40 pixels. Any tip on what might be 开发者_Python百科wrong?


I found the solution. In PreCreateWindow(CREATESTRUCT& cs), CREATESTRUCT was modified, like this

cs.style = WS_OVERLAPPEDWINDOW | WS_MAXIMIZE;

Apparently, this was causing wrong WINDOWPLACEMENT coordinates. When changed to:

cs.style = WS_OVERLAPPEDWINDOW;

with call to

ShowWindows(SW_MAXIMIZE)

Everything worked fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消