TaskPageSamples.cpp
上传用户:szled88
上传日期:2015-04-09
资源大小:43957k
文件大小:5k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // TaskPageSamples.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "resource.h"
  5. #include "TaskSheetProperties.h"
  6. #include "TaskPageSamples.h"
  7. #include "TaskDialogSamples.h"
  8. // CTaskPageSamples dialog
  9. IMPLEMENT_DYNAMIC(CTaskPageSamples, CPropertyPage)
  10. CTaskPageSamples::CTaskPageSamples()
  11. : CPropertyPage(CTaskPageSamples::IDD)
  12. , m_bSkinFramework(FALSE)
  13. {
  14. m_pDlgParent = 0;
  15. }
  16. CTaskPageSamples::~CTaskPageSamples()
  17. {
  18. }
  19. void CTaskPageSamples::DoDataExchange(CDataExchange* pDX)
  20. {
  21. CPropertyPage::DoDataExchange(pDX);
  22. DDX_Control(pDX, IDC_STATIC_LINK, m_wndLinkCtrl);
  23. DDX_Control(pDX, IDC_STATIC_TDPAD, m_wndLinkPadCtrl);
  24. DDX_Check(pDX, IDC_CHECK_SKINFRAMEWORK, m_bSkinFramework);
  25. }
  26. BEGIN_MESSAGE_MAP(CTaskPageSamples, CPropertyPage)
  27. ON_BN_CLICKED(IDC_STATIC_LINK, OnLinkClicked)
  28. ON_BN_CLICKED(IDC_STATIC_TDPAD, OnLinkTDPadClicked)
  29. ON_BN_CLICKED(IDC_CHECK_SKINFRAMEWORK, OnBnClickedCheckSkinframework)
  30. ON_BN_CLICKED(IDC_BUTTON_PROGRESSDIALOG, OnBnClickedButtonProgressdialog)
  31. ON_BN_CLICKED(IDC_BUTTON_DYNAMICDIALOG, OnBnClickedButtonDynamicdialog)
  32. ON_BN_CLICKED(IDC_BUTTON_TIMERDIALOG, OnBnClickedButtonTimerdialog)
  33. ON_BN_CLICKED(IDC_BUTTON_SHEET, OnBnClickedButtonSheet)
  34. ON_BN_CLICKED(IDC_BUTTON_XMLDIALOG1, OnBnClickedXMLDialog1)
  35. ON_BN_CLICKED(IDC_BUTTON_XMLDIALOG2, OnBnClickedXMLDialog2)
  36. ON_BN_CLICKED(IDC_BUTTON_XMLDIALOG3, OnBnClickedXMLDialog3)
  37. ON_BN_CLICKED(IDC_BUTTON_XMLDIALOG4, OnBnClickedXMLDialog4)
  38. ON_BN_CLICKED(IDC_BUTTON_XMLDIALOG5, OnBnClickedXMLDialog5)
  39. ON_BN_CLICKED(IDC_BUTTON_XMLDIALOG6, OnBnClickedXMLDialog6)
  40. ON_BN_CLICKED(IDC_BUTTON_XMLDIALOG7, OnBnClickedXMLDialog7)
  41. END_MESSAGE_MAP()
  42. // CTaskPageSamples message handlers
  43. BOOL CTaskPageSamples::OnInitDialog() 
  44. {
  45. CPropertyPage::OnInitDialog();
  46. // TODO: Add extra initialization here
  47. m_pDlgParent = DYNAMIC_DOWNCAST(CTaskSheetProperties, GetParent());
  48. ASSERT_VALID(m_pDlgParent);
  49. return TRUE;  // return TRUE unless you set the focus to a control
  50. // EXCEPTION: OCX Property Pages should return FALSE
  51. }
  52. void CTaskPageSamples::OnLinkClicked()
  53. {
  54. CXTPTaskDialogLinkCtrl::LINKITEM* pItem = m_wndLinkCtrl.GetFocusedLink();
  55. if (pItem) AfxMessageBox(pItem->strUrl);
  56. }
  57. void CTaskPageSamples::OnLinkTDPadClicked()
  58. {
  59. CXTPTaskDialogLinkCtrl::LINKITEM* pItem = m_wndLinkPadCtrl.GetFocusedLink();
  60. if (pItem) ::ShellExecute(NULL, _T("open"), pItem->strUrl, 0, 0, SW_SHOW);
  61. }
  62. void CTaskPageSamples::OnBnClickedCheckSkinframework()
  63. {
  64. UpdateData();
  65. #ifdef _XTP_INCLUDE_SKINFRAMEWORK
  66. if (m_bSkinFramework)
  67. {
  68. XTPSkinManager()->LoadSkin(_T("Styles\zune.msstyles"));
  69. }
  70. else
  71. {
  72. XTPSkinManager()->LoadSkin(0, 0);
  73. }
  74. #endif
  75. }
  76. void CTaskPageSamples::OnBnClickedButtonSheet()
  77. {
  78. CPropetySheetTaskDialog taskDlg(this);
  79. int nRet = (int)taskDlg.DoModal(m_pDlgParent->m_bUseComCtl32);
  80. TRACE(_T("Result = %in"), nRet);
  81. TRACE(_T("Option = %in"), taskDlg.m_page2.m_nOption);
  82. TRACE(_T("CheckState = %in"), taskDlg.m_page3.m_bState);
  83. }
  84. void CTaskPageSamples::OnBnClickedButtonProgressdialog()
  85. {
  86. CProgressEffectsDialog taskDlg(this);
  87. taskDlg.SetCommonButtons(TDCBF_CANCEL_BUTTON);
  88. taskDlg.SetMainIcon(TD_WARNING_ICON);
  89. taskDlg.SetMainInstruction(_T("Change Password"));
  90. taskDlg.SetContent(_T("Remember your changed password."));
  91. INT_PTR nRet = taskDlg.DoModal(m_pDlgParent->m_bUseComCtl32);
  92. switch (nRet)
  93. {
  94. case 0: 
  95. AfxMessageBox(_T("Task Dialog could not be created!"));
  96. break;
  97. case IDOK:
  98. // the user pressed the OK button, change password.
  99. break;
  100. case IDCANCEL:
  101. // user canceled the dialog.
  102. break;
  103. };
  104. }
  105. void CTaskPageSamples::OnBnClickedButtonDynamicdialog()
  106. {
  107. CDynamicTextDialog td(this);
  108. td.DoModal(m_pDlgParent->m_bUseComCtl32);
  109. }
  110. void CTaskPageSamples::OnBnClickedButtonTimerdialog()
  111. {
  112. CTimerDialog td(this);
  113. td.DoModal(m_pDlgParent->m_bUseComCtl32);
  114. }
  115. void CTaskPageSamples::OnShowXMLDialog(LPCTSTR lpszName)
  116. {
  117. CXTPTaskDialog td(this);
  118. VERIFY(td.CreateFromResource(IDR_DIALOGS, lpszName));
  119. td.DoModal(m_pDlgParent->m_bUseComCtl32);
  120. }
  121. void CTaskPageSamples::OnBnClickedXMLDialog1()
  122. {
  123. OnShowXMLDialog(_T("Dialog001"));
  124. }
  125. void CTaskPageSamples::OnBnClickedXMLDialog2()
  126. {
  127. OnShowXMLDialog(_T("Dialog002"));
  128. }
  129. void CTaskPageSamples::OnBnClickedXMLDialog3()
  130. {
  131. OnShowXMLDialog(_T("Dialog003"));
  132. }
  133. void CTaskPageSamples::OnBnClickedXMLDialog4()
  134. {
  135. OnShowXMLDialog(_T("Dialog004"));
  136. }
  137. void CTaskPageSamples::OnBnClickedXMLDialog5()
  138. {
  139. OnShowXMLDialog(_T("Dialog005"));
  140. }
  141. void CTaskPageSamples::OnBnClickedXMLDialog6()
  142. {
  143. OnShowXMLDialog(_T("Dialog006"));
  144. }
  145. void CTaskPageSamples::OnBnClickedXMLDialog7()
  146. {
  147. CXTPTaskDialog td(this);
  148. LPCTSTR rglpsz[3];
  149. rglpsz[0] = _T("ToolkitEval.zip");
  150. rglpsz[1] = _T("WinZip File, 10.8MB");
  151. rglpsz[2] = _T("www.codejock.com");
  152. VERIFY(td.CreateFromResourceParam(AfxGetInstanceHandle(), IDR_DIALOGS, _T("Dialog007"), rglpsz, 3));
  153. td.DoModal(m_pDlgParent->m_bUseComCtl32);
  154. }