MyPropertyPages.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. // MyPropertyPages.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "resource.h"
  5. #include "MyPropertyPages.h"
  6. #ifdef _DEBUG
  7. #undef THIS_FILE
  8. static char BASED_CODE THIS_FILE[] = __FILE__;
  9. #endif
  10. IMPLEMENT_DYNCREATE(CMyPropertyPage1, CResizablePageEx)
  11. IMPLEMENT_DYNCREATE(CMyPropertyPage2, CResizablePageEx)
  12. IMPLEMENT_DYNCREATE(CMyPropertyPage3, CResizablePageEx)
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CMyPropertyPage1 property page
  15. CMyPropertyPage1::CMyPropertyPage1() : CResizablePageEx(CMyPropertyPage1::IDD)
  16. {
  17. //{{AFX_DATA_INIT(CMyPropertyPage1)
  18. // NOTE: the ClassWizard will add member initialization here
  19. //}}AFX_DATA_INIT
  20. }
  21. CMyPropertyPage1::~CMyPropertyPage1()
  22. {
  23. }
  24. void CMyPropertyPage1::DoDataExchange(CDataExchange* pDX)
  25. {
  26. CResizablePageEx::DoDataExchange(pDX);
  27. //{{AFX_DATA_MAP(CMyPropertyPage1)
  28. // NOTE: the ClassWizard will add DDX and DDV calls here
  29. //}}AFX_DATA_MAP
  30. }
  31. BEGIN_MESSAGE_MAP(CMyPropertyPage1, CResizablePageEx)
  32. //{{AFX_MSG_MAP(CMyPropertyPage1)
  33. //}}AFX_MSG_MAP
  34. END_MESSAGE_MAP()
  35. BOOL CMyPropertyPage1::OnInitDialog()
  36. {
  37. CResizablePageEx::OnInitDialog();
  38. // preset layout
  39. AddAnchor(IDC_EDIT1, TOP_LEFT, BOTTOM_RIGHT);
  40. AddAnchor(IDC_BUTTON1, TOP_RIGHT, BOTTOM_RIGHT);
  41. SetDlgItemText(IDC_EDIT1, _T("Pages have been designed for a property")
  42. _T(" sheet dialog, so they have bad margins in wizard mode.\r\n\r\n")
  43. _T("The active page can be saved together with dialog's size and")
  44. _T(" position. Select another page and try to close and open again."));
  45. return TRUE;
  46. }
  47. BOOL CMyPropertyPage1::OnSetActive()
  48. {
  49. ((CPropertySheet*)GetParent())->SetWizardButtons(PSWIZB_NEXT);
  50. return CResizablePageEx::OnSetActive();
  51. }
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CMyPropertyPage2 property page
  54. CMyPropertyPage2::CMyPropertyPage2() : CResizablePageEx(CMyPropertyPage2::IDD)
  55. {
  56. //{{AFX_DATA_INIT(CMyPropertyPage2)
  57. // NOTE: the ClassWizard will add member initialization here
  58. //}}AFX_DATA_INIT
  59. }
  60. CMyPropertyPage2::~CMyPropertyPage2()
  61. {
  62. }
  63. void CMyPropertyPage2::DoDataExchange(CDataExchange* pDX)
  64. {
  65. CResizablePageEx::DoDataExchange(pDX);
  66. //{{AFX_DATA_MAP(CMyPropertyPage2)
  67. DDX_Control(pDX, IDC_LIST1, m_ctlEdit1);
  68. //}}AFX_DATA_MAP
  69. }
  70. BEGIN_MESSAGE_MAP(CMyPropertyPage2, CResizablePageEx)
  71. //{{AFX_MSG_MAP(CMyPropertyPage2)
  72. //}}AFX_MSG_MAP
  73. END_MESSAGE_MAP()
  74. BOOL CMyPropertyPage2::OnInitDialog()
  75. {
  76. CResizablePageEx::OnInitDialog();
  77. // preset layout
  78. AddAnchor(IDC_LIST1, TOP_LEFT, ANCHOR(50,70));
  79. AddAnchor(IDC_PICTURE1, ANCHOR(50,0), ANCHOR(100,70));
  80. AddAnchor(IDC_GROUP1, ANCHOR(0,70), BOTTOM_RIGHT);
  81. AddAnchor(IDC_CHECK1, ANCHOR(0,85));
  82. AddAnchor(IDC_RADIO4, ANCHOR(100,85));
  83. AddAnchor(IDC_COMBO1, ANCHOR(100,70));
  84. AddAnchor(IDC_BUTTON1, BOTTOM_RIGHT);
  85. m_ctlEdit1.AddString(_T("Just a single item to test the ")
  86. _T("listbox behavior with very long lines..."));
  87. m_ctlEdit1.SetHorizontalExtent(300);
  88. return TRUE;
  89. }
  90. BOOL CMyPropertyPage2::OnSetActive()
  91. {
  92. ((CPropertySheet*)GetParent())->SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT);
  93. return CResizablePageEx::OnSetActive();
  94. }
  95. /////////////////////////////////////////////////////////////////////////////
  96. // CMyPropertyPage3 property page
  97. CMyPropertyPage3::CMyPropertyPage3() : CResizablePageEx(CMyPropertyPage3::IDD)
  98. {
  99. //{{AFX_DATA_INIT(CMyPropertyPage3)
  100. // NOTE: the ClassWizard will add member initialization here
  101. //}}AFX_DATA_INIT
  102. }
  103. CMyPropertyPage3::~CMyPropertyPage3()
  104. {
  105. }
  106. void CMyPropertyPage3::DoDataExchange(CDataExchange* pDX)
  107. {
  108. CResizablePageEx::DoDataExchange(pDX);
  109. //{{AFX_DATA_MAP(CMyPropertyPage3)
  110. // NOTE: the ClassWizard will add DDX and DDV calls here
  111. //}}AFX_DATA_MAP
  112. }
  113. BEGIN_MESSAGE_MAP(CMyPropertyPage3, CResizablePageEx)
  114. //{{AFX_MSG_MAP(CMyPropertyPage3)
  115. //}}AFX_MSG_MAP
  116. END_MESSAGE_MAP()
  117. BOOL CMyPropertyPage3::OnInitDialog()
  118. {
  119. CResizablePageEx::OnInitDialog();
  120. // preset layout
  121. AddAnchor(IDC_LABEL1, TOP_LEFT);
  122. AddAnchor(IDC_EDIT1, TOP_LEFT, BOTTOM_RIGHT);
  123. AddAnchor(IDC_SLIDER1, BOTTOM_LEFT, BOTTOM_RIGHT);
  124. return TRUE;
  125. }
  126. BOOL CMyPropertyPage3::OnSetActive()
  127. {
  128. ((CPropertySheet*)GetParent())->SetWizardButtons(PSWIZB_BACK | PSWIZB_FINISH);
  129. return CResizablePageEx::OnSetActive();
  130. }