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

对话框与窗口

开发平台:

Visual C++

  1. // ThemePage.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "TabbedToolbar.h"
  5. #include "ThemePage.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CThemePage property page
  13. IMPLEMENT_DYNCREATE(CThemePage, CPropertyPage)
  14. CThemePage::CThemePage() : CPropertyPage(CThemePage::IDD)
  15. {
  16. //{{AFX_DATA_INIT(CThemePage)
  17. m_nTheme = 2;
  18. //}}AFX_DATA_INIT
  19. }
  20. CThemePage::~CThemePage()
  21. {
  22. }
  23. void CThemePage::DoDataExchange(CDataExchange* pDX)
  24. {
  25. CPropertyPage::DoDataExchange(pDX);
  26. //{{AFX_DATA_MAP(CThemePage)
  27. DDX_Radio(pDX, IDC_RADIO_THEME, m_nTheme);
  28. //}}AFX_DATA_MAP
  29. }
  30. BEGIN_MESSAGE_MAP(CThemePage, CPropertyPage)
  31. //{{AFX_MSG_MAP(CThemePage)
  32. ON_BN_CLICKED(IDC_RADIO_THEME, OnRadioTheme)
  33. ON_BN_CLICKED(IDC_RADIO_THEME2, OnRadioTheme)
  34. ON_BN_CLICKED(IDC_RADIO_THEME3, OnRadioTheme)
  35. ON_BN_CLICKED(IDC_RADIO_THEME4, OnRadioTheme)
  36. ON_BN_CLICKED(IDC_RADIO_THEME5, OnRadioTheme)
  37. //}}AFX_MSG_MAP
  38. END_MESSAGE_MAP()
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CThemePage message handlers
  41. void CThemePage::OnRadioTheme() 
  42. {
  43. UpdateData();
  44. CXTPMDIFrameWnd* pFrame = (CXTPMDIFrameWnd*)AfxGetMainWnd();
  45. CXTPCommandBars* pCommandBars = pFrame->GetCommandBars();
  46. CXTPTabToolBar* pToolBar = (CXTPTabToolBar*)pCommandBars->GetToolBar(IDR_MAINFRAME);
  47. if (m_nTheme == 0)
  48. {
  49. CXTPPaintManager::SetTheme(xtpThemeOffice2000);
  50. pToolBar->GetPaintManager()->m_bDisableLunaColors = TRUE;
  51. pToolBar->GetPaintManager()->m_bFillBackground = TRUE;
  52. pToolBar->GetPaintManager()->SetAppearance(xtpTabAppearancePropertyPage);
  53. }
  54. if (m_nTheme == 1)
  55. {
  56. CXTPPaintManager::SetTheme(xtpThemeOfficeXP);
  57. pToolBar->GetPaintManager()->m_bDisableLunaColors = TRUE;
  58. pToolBar->GetPaintManager()->m_bFillBackground = TRUE;
  59. pToolBar->GetPaintManager()->SetAppearance(xtpTabAppearanceVisualStudio);
  60. }
  61. if (m_nTheme == 2)
  62. {
  63. CXTPPaintManager::SetTheme(xtpThemeOffice2003);
  64. pToolBar->GetPaintManager()->m_bDisableLunaColors = FALSE;
  65. pToolBar->GetPaintManager()->m_bFillBackground = FALSE;
  66. pToolBar->GetPaintManager()->SetAppearance(xtpTabAppearancePropertyPage2003);
  67. }
  68. if (m_nTheme == 3)
  69. {
  70. CXTPPaintManager::SetTheme(xtpThemeWhidbey);
  71. pToolBar->GetPaintManager()->m_bDisableLunaColors = TRUE;
  72. pToolBar->GetPaintManager()->m_bFillBackground = FALSE;
  73. pToolBar->GetPaintManager()->SetAppearance(xtpTabAppearanceVisualStudio2005);
  74. }
  75. if (m_nTheme == 4)
  76. {
  77. CXTPPaintManager::SetTheme(xtpThemeNativeWinXP);
  78. pToolBar->GetPaintManager()->m_bDisableLunaColors = TRUE;
  79. pToolBar->GetPaintManager()->m_bFillBackground = FALSE;
  80. pToolBar->GetPaintManager()->SetAppearance(xtpTabAppearancePropertyPage);
  81. pToolBar->GetPaintManager()->SetColor(xtpTabColorWinXP);
  82. }
  83. pCommandBars->RedrawCommandBars();
  84. ((CView*)GetParent()->GetParent())->GetDocument()->UpdateAllViews(0);
  85. }
  86. void CThemePage::Update()
  87. {
  88. }