在MFC C ++中获取窗口或面板的大小(getting the size of a window or panel in MFC C++)

编程入门 行业动态 更新时间:2024-10-25 20:25:21
在MFC C ++中获取窗口或面板的大小(getting the size of a window or panel in MFC C++)

如何在MFC C ++中获得“窗口”或“面板”的大小 ? 有功能还是什么?

How can I get the size of a "window" or a "panel" in MFC C++? is there a function or something?

最满意答案

有CWnd::GetWindowRect :

CWnd wnd; // the window to query CRect wndrect; wnd.GetWindowRect(wndrect);

从那里你可以得到

int w = wndrect.Width (); int h = wndrect.Height();

这适用于所有类型的MFC窗口,因为所有MFC窗口类都继承CWnd 。

There is CWnd::GetWindowRect:

CWnd wnd; // the window to query CRect wndrect; wnd.GetWindowRect(wndrect);

And from there you can get

int w = wndrect.Width (); int h = wndrect.Height();

This will work for all kinds of MFC windows because all MFC window classes inherit CWnd.

更多推荐

本文发布于:2023-08-05 06:18:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1428783.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:面板   大小   窗口   MFC   window

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!