MyPropertyPages.cpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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, CPropertyPage)
  11. IMPLEMENT_DYNCREATE(CMyPropertyPage2, CPropertyPage)
  12. IMPLEMENT_DYNCREATE(CMyPropertyPage3, CPropertyPage)
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CMyPropertyPage1 property page
  15. CMyPropertyPage1::CMyPropertyPage1() : CPropertyPage(CMyPropertyPage1::IDD)
  16. {
  17. //{{AFX_DATA_INIT(CMyPropertyPage1)
  18. //}}AFX_DATA_INIT
  19. }
  20. CMyPropertyPage1::~CMyPropertyPage1()
  21. {
  22. }
  23. void CMyPropertyPage1::DoDataExchange(CDataExchange* pDX)
  24. {
  25. CPropertyPage::DoDataExchange(pDX);
  26. //{{AFX_DATA_MAP(CMyPropertyPage1)
  27. DDX_Control(pDX, IDC_LIST1, m_List);
  28. //}}AFX_DATA_MAP
  29. }
  30. BEGIN_MESSAGE_MAP(CMyPropertyPage1, CPropertyPage)
  31. //{{AFX_MSG_MAP(CMyPropertyPage1)
  32. ON_WM_SIZE()
  33. //}}AFX_MSG_MAP
  34. END_MESSAGE_MAP()
  35. BOOL CMyPropertyPage1::OnInitDialog()
  36. {
  37. CPropertyPage::OnInitDialog();
  38. m_List.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
  39. InitListCtrl(&m_List);
  40. FillListCtrl(&m_List);
  41. return TRUE;
  42. }
  43. BOOL CMyPropertyPage1::OnSetActive()
  44. {
  45. ((CPropertySheet*)GetParent())->SetWizardButtons(PSWIZB_NEXT);
  46. return CPropertyPage::OnSetActive();
  47. }
  48. void CMyPropertyPage1::OnSize(UINT nType, int cx, int cy)
  49. {
  50. CPropertyPage::OnSize(nType, cx, cy);
  51. if (!::IsWindow(m_List.m_hWnd))
  52. return;
  53. m_List.LockWindowUpdate();
  54. m_List.MoveWindow(0, 0, cx, cy);
  55. CRect rect;
  56. m_List.GetClientRect(&rect);
  57. int w = rect.Width();
  58. int total_cx = 0;
  59. int n = m_List.GetColumns();
  60. int nPad = m_List.GetCellPadding();
  61. w = w - n * 2 * nPad;
  62. int nBar = ::GetSystemMetrics(SM_CXVSCROLL);
  63. // adjust columns
  64. for (int i = 0; i < n; i++)
  65. {
  66. int colwidth = (i == (n - 1)) ? w - total_cx - nBar : (w * m_nColWidths[i]) / 64;
  67. total_cx += colwidth;
  68. m_List.SetColumnWidth(i, colwidth);
  69. }
  70. m_List.UnlockWindowUpdate();
  71. }
  72. /////////////////////////////////////////////////////////////////////////////
  73. // CMyPropertyPage2 property page
  74. BEGIN_MESSAGE_MAP(CMyPropertyPage2, CPropertyPage)
  75. //{{AFX_MSG_MAP(CMyPropertyPage2)
  76. //}}AFX_MSG_MAP
  77. END_MESSAGE_MAP()
  78. CMyPropertyPage2::CMyPropertyPage2() : CPropertyPage(CMyPropertyPage2::IDD)
  79. {
  80. //{{AFX_DATA_INIT(CMyPropertyPage2)
  81. //}}AFX_DATA_INIT
  82. }
  83. CMyPropertyPage2::~CMyPropertyPage2()
  84. {
  85. }
  86. void CMyPropertyPage2::DoDataExchange(CDataExchange* pDX)
  87. {
  88. CPropertyPage::DoDataExchange(pDX);
  89. //{{AFX_DATA_MAP(CMyPropertyPage2)
  90. //}}AFX_DATA_MAP
  91. }
  92. BOOL CMyPropertyPage2::OnInitDialog()
  93. {
  94. CPropertyPage::OnInitDialog();
  95. return TRUE;
  96. }
  97. BOOL CMyPropertyPage2::OnSetActive()
  98. {
  99. ((CPropertySheet*)GetParent())->SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT);
  100. return CPropertyPage::OnSetActive();
  101. }
  102. /////////////////////////////////////////////////////////////////////////////
  103. // CMyPropertyPage3 property page
  104. BEGIN_MESSAGE_MAP(CMyPropertyPage3, CPropertyPage)
  105. //{{AFX_MSG_MAP(CMyPropertyPage3)
  106. //}}AFX_MSG_MAP
  107. END_MESSAGE_MAP()
  108. CMyPropertyPage3::CMyPropertyPage3() : CPropertyPage(CMyPropertyPage3::IDD)
  109. {
  110. //{{AFX_DATA_INIT(CMyPropertyPage3)
  111. //}}AFX_DATA_INIT
  112. }
  113. CMyPropertyPage3::~CMyPropertyPage3()
  114. {
  115. }
  116. void CMyPropertyPage3::DoDataExchange(CDataExchange* pDX)
  117. {
  118. CPropertyPage::DoDataExchange(pDX);
  119. //{{AFX_DATA_MAP(CMyPropertyPage3)
  120. //}}AFX_DATA_MAP
  121. }
  122. BOOL CMyPropertyPage3::OnInitDialog()
  123. {
  124. CPropertyPage::OnInitDialog();
  125. return TRUE;
  126. }
  127. BOOL CMyPropertyPage3::OnSetActive()
  128. {
  129. ((CPropertySheet*)GetParent())->SetWizardButtons(PSWIZB_BACK | PSWIZB_FINISH);
  130. return CPropertyPage::OnSetActive();
  131. }