ResizablePage.cpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // ResizablePage.cpp : implementation file
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4. //
  5. // Copyright (C) 2000-2001 by Paolo Messina
  6. // (http://www.geocities.com/ppescher - ppescher@yahoo.com)
  7. //
  8. // The contents of this file are subject to the Artistic License (the "License").
  9. // You may not use this file except in compliance with the License.
  10. // You may obtain a copy of the License at:
  11. // http://www.opensource.org/licenses/artistic-license.html
  12. //
  13. // If you find this code useful, credits would be nice!
  14. //
  15. /////////////////////////////////////////////////////////////////////////////
  16. #include "stdafx.h"
  17. #include "ResizablePage.h"
  18. #ifdef _DEBUG
  19. #define new DEBUG_NEW
  20. #undef THIS_FILE
  21. static char THIS_FILE[] = __FILE__;
  22. #endif
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CResizablePage
  25. IMPLEMENT_DYNCREATE(CResizablePage, CPropertyPage)
  26. inline void CResizablePage::Construct()
  27. {
  28. m_bInitDone = FALSE;
  29. }
  30. CResizablePage::CResizablePage()
  31. {
  32. Construct();
  33. }
  34. CResizablePage::CResizablePage(UINT nIDTemplate, UINT nIDCaption)
  35. : CPropertyPage(nIDTemplate, nIDCaption)
  36. {
  37. Construct();
  38. }
  39. CResizablePage::CResizablePage(LPCTSTR lpszTemplateName, UINT nIDCaption)
  40. : CPropertyPage(lpszTemplateName, nIDCaption)
  41. {
  42. Construct();
  43. }
  44. CResizablePage::~CResizablePage()
  45. {
  46. }
  47. BEGIN_MESSAGE_MAP(CResizablePage, CPropertyPage)
  48. //{{AFX_MSG_MAP(CResizablePage)
  49. ON_WM_SIZE()
  50. ON_WM_ERASEBKGND()
  51. //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CResizablePage message handlers
  55. BOOL CResizablePage::OnInitDialog()
  56. {
  57. CPropertyPage::OnInitDialog();
  58. /* // gets the initial size as the min track size
  59. CRect rc;
  60. GetWindowRect(&rc);
  61. */
  62. m_bInitDone = TRUE;
  63. return TRUE; // return TRUE unless you set the focus to a control
  64. // EXCEPTION: OCX Property Pages should return FALSE
  65. }
  66. void CResizablePage::OnSize(UINT nType, int cx, int cy)
  67. {
  68. CWnd::OnSize(nType, cx, cy);
  69. if (m_bInitDone)
  70. ArrangeLayout();
  71. }
  72. BOOL CResizablePage::OnEraseBkgnd(CDC* pDC)
  73. {
  74. ClipChildren(pDC);
  75. return CPropertyPage::OnEraseBkgnd(pDC);
  76. }