获取窗口当前大小 [英] Get the window current size

查看:115
本文介绍了获取窗口当前大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个对话框应用程序,该应用程序已调整大小.我的要求是在窗口大小增加时增加列表控件的字体和列宽度,而在窗口大小减小时减少字体和列宽度.

如何获得当前窗口的位置并比较尺寸是否比以前的尺寸大还是小?我在OnSizing()处理程序中尝试过GetWindowRect().但是我无法调整列表控件的大小.
请帮助我..

Hi,
I have a dialog application, which has got resizing. My requirement is to increase the font and column width of list control when the window size increases,and decrease the font and column width when the window size is reduced.

How can i get the current window position and compare whether the size is increased or decreased from previous size? I tried GetWindowRect() in the OnSizing() handler. But i was not able to resize the list control.
Please help me someone..

推荐答案

当用户仍在调整窗口大小时,将触发OnSizing()事件.

此时,GetWindowRect()很可能是Windows pos是原始位置,因此这对您不起作用.

此外,OnSizing()具有一个LPRECT参数,该参数包含大小时的Windows坐标,因此可用于实现所需的内容.

最后,您可以选择切换到OnSize()事件的方式,当用户调整窗口大小并且可以自由地重新调整控件并且GetWindowRect()GetClientRect()正确时,将触发该事件.
The OnSizing() event is fired when the user is still in the process of sizing the Window.

At this point GetWindowRect() it is most likely that windows pos is the original placement, so this wouldn''t work for you.

Also the OnSizing() has a LPRECT parameter that contains the windows coordinates while size, so this could be used to achieve what you want.

Finally you may what to switch to the OnSize() event this will be fired when the user has finished sizing the window and you are free to re-adjust your controls and GetWindowRect() and GetClientRect() will be correct.


这篇关于获取窗口当前大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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