123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- // ResizablePage.cpp : implementation file
- //
- /////////////////////////////////////////////////////////////////////////////
- //
- // This file is part of ResizableLib
- // https://github.com/ppescher/resizablelib
- //
- // Copyright (C) 2000-2015 by Paolo Messina
- // mailto:ppescher@hotmail.com
- //
- // The contents of this file are subject to the Artistic License 2.0
- // http://opensource.org/licenses/Artistic-2.0
- //
- // If you find this code useful, credits would be nice!
- //
- /////////////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "ResizablePage.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CResizablePage
- IMPLEMENT_DYNCREATE(CResizablePage, CPropertyPage)
- CResizablePage::CResizablePage()
- {
- }
- CResizablePage::CResizablePage(UINT nIDTemplate, UINT nIDCaption)
- : CPropertyPage(nIDTemplate, nIDCaption)
- {
- }
- CResizablePage::CResizablePage(LPCTSTR lpszTemplateName, UINT nIDCaption)
- : CPropertyPage(lpszTemplateName, nIDCaption)
- {
- }
- CResizablePage::~CResizablePage()
- {
- }
- BEGIN_MESSAGE_MAP(CResizablePage, CPropertyPage)
- //{{AFX_MSG_MAP(CResizablePage)
- ON_WM_SIZE()
- ON_WM_ERASEBKGND()
- ON_WM_GETMINMAXINFO()
- ON_WM_DESTROY()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CResizablePage message handlers
- void CResizablePage::OnSize(UINT nType, int cx, int cy)
- {
- CWnd::OnSize(nType, cx, cy);
-
- ArrangeLayout();
- }
- BOOL CResizablePage::OnEraseBkgnd(CDC* pDC)
- {
- ClipChildren(pDC, FALSE);
- BOOL bRet = CPropertyPage::OnEraseBkgnd(pDC);
- ClipChildren(pDC, TRUE);
- return bRet;
- }
- void CResizablePage::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
- {
- MinMaxInfo(lpMMI);
- }
- BOOL CResizablePage::OnInitDialog()
- {
- CPropertyPage::OnInitDialog();
-
- // set the initial size as the min track size
- CRect rc;
- GetWindowRect(&rc);
- SetMinTrackSize(rc.Size());
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CResizablePage::OnDestroy()
- {
- // remove child windows
- RemoveAllAnchors();
- ResetAllRects();
- CPropertyPage::OnDestroy();
- }
- LRESULT CResizablePage::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
- {
- if (message != WM_NCCALCSIZE || wParam == 0)
- return CPropertyPage::WindowProc(message, wParam, lParam);
- LRESULT lResult = 0;
- HandleNcCalcSize(FALSE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
- lResult = CPropertyPage::WindowProc(message, wParam, lParam);
- HandleNcCalcSize(TRUE, (LPNCCALCSIZE_PARAMS)lParam, lResult);
- return lResult;
- }
|