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

对话框与窗口

开发平台:

Visual C++

  1. // MarkupPage.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "button.h"
  5. #include "MarkupPage.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CMarkupPage property page
  13. IMPLEMENT_DYNCREATE(CMarkupPage, CPropertyPage)
  14. CMarkupPage::CMarkupPage() : CPropertyPage(CMarkupPage::IDD)
  15. {
  16. //{{AFX_DATA_INIT(CMarkupPage)
  17. //}}AFX_DATA_INIT
  18. }
  19. CMarkupPage::~CMarkupPage()
  20. {
  21. }
  22. void CMarkupPage::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CPropertyPage::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CMarkupPage)
  26. DDX_Control(pDX, IDC_RADIO_WITHLINK, m_btnRadioWithLink);
  27. DDX_Control(pDX, IDC_CHECK_DELETEOUTBOX, m_btnDeleteOutbox);
  28. DDX_Control(pDX, IDC_CHECK_DELETEINBOX, m_btnDeleteInbox);
  29. DDX_Control(pDX, IDC_BUTTON_FIREWALL, m_btnFirewall);
  30. DDX_Control(pDX, IDC_BUTTON_MARKUP, m_btnPushButton);
  31. DDX_Control(pDX, IDC_RADIO_MARKUP, m_btnRadio);
  32. DDX_Control(pDX, IDC_CHECK_MARKUP, m_btnCheckBox);
  33. //}}AFX_DATA_MAP
  34. }
  35. BEGIN_MESSAGE_MAP(CMarkupPage, CPropertyPage)
  36. //{{AFX_MSG_MAP(CMarkupPage)
  37. //}}AFX_MSG_MAP
  38. END_MESSAGE_MAP()
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CMarkupPage message handlers
  41. BOOL CMarkupPage::OnInitDialog() 
  42. {
  43. CPropertyPage::OnInitDialog();
  44. #ifdef _XTP_INCLUDE_MARKUP
  45. m_btnCheckBox.EnableMarkup();
  46. m_btnRadio.EnableMarkup();
  47. m_btnPushButton.EnableMarkup();
  48. m_btnFirewall.EnableMarkup();
  49. m_btnDeleteInbox.EnableMarkup();
  50. m_btnDeleteOutbox.EnableMarkup();
  51. m_btnRadioWithLink.EnableMarkup();
  52. m_btnFirewall.SetWindowText(
  53. _T("<StackPanel Orientation='Horizontal'>")
  54. _T("<Image Source='res://glyph.bmp' VerticalAlignment='Center'/>")
  55. _T("<StackPanel Margin='5, 0, 0, 0'>")
  56.    _T("<TextBlock Foreground='#151c55' FontSize='18'>Turn on Firewall now</TextBlock>")
  57.      _T("<TextBlock FontSize='11'>(recommended)</TextBlock>")
  58. _T("</StackPanel>")
  59. _T("</StackPanel>"));
  60. m_btnDeleteInbox.SetWindowText(
  61. _T("<TextBlock><Run FontWeight='Bold'>Delete Inbox </Run> <Run Foreground='Blue'>[10 Items]</Run></TextBlock>"));
  62. m_btnDeleteOutbox.SetWindowText(
  63. _T("<TextBlock><Run FontWeight='Bold'>Delete Outbox </Run> <Run Foreground='Green'>[14 Items]</Run></TextBlock>"));
  64. m_btnDeleteOutbox.SetWindowText(
  65. _T("<TextBlock><Run FontWeight='Bold'>Delete Outbox </Run> <Run Foreground='Green'>[14 Items]</Run></TextBlock>"));
  66. m_btnDeleteOutbox.SetWindowText(
  67. _T("<TextBlock><Run FontWeight='Bold'>Delete Outbox </Run> <Run Foreground='Green'>[14 Items]</Run></TextBlock>"));
  68. m_btnRadioWithLink.SetWindowText(
  69. _T("<TextBlock>Radio Button with <Hyperlink>Hyperlink</Hyperlink></TextBlock>"));
  70. m_btnRadioWithLink.GetMarkupContext()->AddHandler(CXTPMarkupHyperlink::m_pClickEvent, 
  71. CreateMarkupClassDelegate(this, &CMarkupPage::OnHyperlinkClick));
  72. #endif
  73. return TRUE;  // return TRUE unless you set the focus to a control
  74.               // EXCEPTION: OCX Property Pages should return FALSE
  75. }
  76. #ifdef _XTP_INCLUDE_MARKUP
  77. void CMarkupPage::OnHyperlinkClick(CXTPMarkupObject* pSender, CXTPMarkupRoutedEventArgs* pArgs)
  78. {
  79. if (pSender->IsKindOf(MARKUP_TYPE(CXTPMarkupHyperlink)))
  80. {
  81. AfxMessageBox(_T("Hyperlink Clicked"));
  82. pArgs->SetHandled();
  83. }
  84. }
  85. #endif