admin管理员组文章数量:1794759
MFC Windows 程序设计
A final aspect of Clock that deserves scrutiny is its OnGetMinMaxInfo handler. As a window is being resized, it receives a series of WM_GETMINMAXINFO messages with lParam pointing to a MINMAXINFO structure containing information about the window's minimum and maximum "tracking" sizes. You can limit a window's minimum and maximum sizes programmatically by processing WM_GETMINMAXINFO messages and copying the minimum width and height to the x and y members of the structure's ptMinTrackSize field and the maximum width and height to the x and y members of the ptMaxTrackSize field. Clock prevents its window from being reduced to less than 120 pixels horizontally and vertically with the following OnGetMinMaxInfo handler:
void CMainWindow::OnGetMinMaxInfo (MINMAXINFO* pMMI) { pMMI->ptMinTrackSize.x = 120; pMMI->ptMinTrackSize.y = 120; } |
---|
The tracking dimensions copied to MINMAXINFO are measured in device units, or pixels. In this example, the window's maximum size is unconstrained because pMMI->ptMaxTrackSize is left unchanged. You could limit the maximum window size to one-half the screen size by adding the statements
pMMI->ptMaxTrackSize.x = ::GetSystemMetrics (SM_CXSCREEN) / 2; pMMI->ptMaxTrackSize.y = ::GetSystemMetrics (SM_CYSCREEN) / 2; |
---|
to the message handler.
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。 原始发表:2024-10-11,如有侵权请联系 cloudcommunity@tencent 删除mfcminimumwindow程序设计windows本文标签: MFC Windows 程序设计
版权声明:本文标题:MFC Windows 程序设计 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1754904604a1708011.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论