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

对话框与窗口

开发平台:

Visual C++

  1. // PaneStyles.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ribbonsample.h"
  5. #include "PaneStyles.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CPaneStyles dialog
  13. CPaneStyles::CPaneStyles(CWnd* pParent /*=NULL*/)
  14. : CXTResizeDialog(CPaneStyles::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CPaneStyles)
  17. //}}AFX_DATA_INIT
  18. }
  19. void CPaneStyles::DoDataExchange(CDataExchange* pDX)
  20. {
  21. CDialog::DoDataExchange(pDX);
  22. //{{AFX_DATA_MAP(CPaneStyles)
  23. DDX_Control(pDX, IDC_LIST_STYLES, m_lstStyles);
  24. DDX_Control(pDX, IDC_CHECK_LINKEDSTYLE, m_chkLinkedStyle);
  25. DDX_Control(pDX, IDC_CHECK_PREVIEW, m_chkPreview);
  26. DDX_Control(pDX, IDC_BUTTON_STYLEINSPECTOR, m_btnStyleInspector);
  27. DDX_Control(pDX, IDC_BUTTON_NEWSTYLE, m_btnNewStyle);
  28. DDX_Control(pDX, IDC_BUTTON_MANAGESTYLES, m_btnManageStyles);
  29. //}}AFX_DATA_MAP
  30. }
  31. BEGIN_MESSAGE_MAP(CPaneStyles, CXTResizeDialog)
  32. //{{AFX_MSG_MAP(CPaneStyles)
  33. ON_WM_CTLCOLOR()
  34. //}}AFX_MSG_MAP
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CPaneStyles message handlers
  38. void CPaneStyles::OnCancel()
  39. {
  40. }
  41. void CPaneStyles::OnOK()
  42. {
  43. }
  44. HBRUSH CPaneStyles::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
  45. {
  46. HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
  47. return m_brush;
  48. }
  49. BOOL CPaneStyles::OnInitDialog() 
  50. {
  51. CXTResizeDialog::OnInitDialog();
  52. SetResize(IDC_LIST_STYLES,       SZ_TOP_LEFT, SZ_BOTTOM_RIGHT);
  53. SetResize(IDC_CHECK_PREVIEW,     SZ_BOTTOM_LEFT, SZ_BOTTOM_LEFT);
  54. SetResize(IDC_CHECK_LINKEDSTYLE,     SZ_BOTTOM_LEFT, SZ_BOTTOM_LEFT);
  55. SetResize(IDC_BUTTON_NEWSTYLE,     SZ_BOTTOM_LEFT, SZ_BOTTOM_LEFT);
  56. SetResize(IDC_BUTTON_STYLEINSPECTOR,     SZ_BOTTOM_LEFT, SZ_BOTTOM_LEFT);
  57. SetResize(IDC_BUTTON_MANAGESTYLES,     SZ_BOTTOM_LEFT, SZ_BOTTOM_LEFT);
  58. m_lstStyles.AddString(_T("Clear All"));
  59. m_lstStyles.AddString(_T("Normal"));
  60. m_lstStyles.AddString(_T("No Spacing"));
  61. m_lstStyles.AddString(_T("Heading 1"));
  62. m_lstStyles.AddString(_T("Heading 2"));
  63. m_lstStyles.AddString(_T("Heading 3"));
  64. m_lstStyles.AddString(_T("Title"));
  65. m_lstStyles.AddString(_T("Subtitle"));
  66. m_lstStyles.SetListStyle(xtListBoxOffice2007);
  67. m_chkLinkedStyle.SetTheme(xtpButtonThemeOffice2007);
  68. m_chkPreview.SetTheme(xtpButtonThemeOffice2007);
  69. m_btnStyleInspector.SetTheme(xtpButtonThemeOffice2007);
  70. m_btnNewStyle.SetTheme(xtpButtonThemeOffice2007);
  71. m_btnManageStyles.SetTheme(xtpButtonThemeOffice2007);
  72. CXTPImageManagerIconHandle ih;
  73. CXTPImageManagerIconHandle ihh;
  74. ih = CXTPImageManagerIcon::LoadBitmapFromResource(MAKEINTRESOURCE(IDC_BUTTON_NEWSTYLE), NULL);
  75. m_btnNewStyle.SetIcon(CSize(16, 16), ih, ihh);
  76. ih = CXTPImageManagerIcon::LoadBitmapFromResource(MAKEINTRESOURCE(IDC_BUTTON_MANAGESTYLES), NULL);
  77. m_btnManageStyles.SetIcon(CSize(16, 16), ih, ihh);
  78. ih = CXTPImageManagerIcon::LoadBitmapFromResource(MAKEINTRESOURCE(IDC_BUTTON_STYLEINSPECTOR), NULL);
  79. m_btnStyleInspector.SetIcon(CSize(16, 16), ih, ihh);
  80. RefreshMetrics();
  81. return TRUE;  // return TRUE unless you set the focus to a control
  82.               // EXCEPTION: OCX Property Pages should return FALSE
  83. }
  84. void CPaneStyles::RefreshMetrics()
  85. {
  86. m_brush.DeleteObject();
  87. COLORREF clr = XTPOffice2007Images()->GetImageColor(_T("DockingPane"), _T("WordPaneBackground"));
  88. m_brush.CreateSolidBrush(clr);
  89. }