DLineProperty.cpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. // DLineProperty.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "EastDraw.h"
  5. #include "DLineProperty.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CDLineProperty
  13. IMPLEMENT_DYNAMIC(CDLineProperty, CPropertySheet)
  14. CDLineProperty::CDLineProperty(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
  15. :CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
  16. {
  17. m_DLineDlg1=new CDLineDlg1;
  18. m_DLineDlg2=new CDLineDlg2;
  19. // m_Mode=new CMode;
  20. this->AddPage(m_DLineDlg1);
  21. this->AddPage(m_DLineDlg2);
  22. // this->AddPage(m_Mode);
  23. //m_Parent=(CEastDrawView*)pParentWnd;
  24. }
  25. CDLineProperty::CDLineProperty(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
  26. :CPropertySheet(pszCaption, pParentWnd, iSelectPage)
  27. {
  28. m_DLineDlg1=new CDLineDlg1;
  29. m_DLineDlg2=new CDLineDlg2;
  30. // m_Mode=new CMode;
  31. this->AddPage(m_DLineDlg1);
  32. this->AddPage(m_DLineDlg2);
  33. // this->AddPage(m_Mode);
  34. }
  35. CDLineProperty::~CDLineProperty()
  36. {
  37. }
  38. BEGIN_MESSAGE_MAP(CDLineProperty, CPropertySheet)
  39. //{{AFX_MSG_MAP(CDLineProperty)
  40. ON_WM_CLOSE()
  41. ON_WM_NCLBUTTONDBLCLK()
  42. ON_WM_CTLCOLOR()
  43. ON_WM_PAINT()
  44. ON_WM_DRAWITEM()
  45. ON_WM_NCPAINT()
  46. //}}AFX_MSG_MAP
  47. END_MESSAGE_MAP()
  48. /////////////////////////////////////////////////////////////////////////////
  49. // CDLineProperty message handlers
  50. void CDLineProperty::OnClose()
  51. {
  52. // TODO: Add your message handler code here and/or call default
  53. this->ShowWindow(false);
  54. //CPropertySheet::OnClose();
  55. }
  56. void CDLineProperty::OnNcLButtonDblClk(UINT nHitTest, CPoint point)
  57. {
  58. // TODO: Add your message handler code here and/or call default
  59. CPropertySheet::OnNcLButtonDblClk(nHitTest, point);
  60. static BOOL s_bExchange=true;
  61. CRect rect;
  62. this->GetWindowRect(&rect);
  63. s_bExchange?this->SetWindowPos(&wndTop,0,0,rect.Width(),rect.Height()/13+1,SWP_NOMOVE):
  64. this->SetWindowPos(&wndTop,0,0,rect.Width(),(rect.Height()-1)*13,SWP_NOMOVE);
  65. s_bExchange=!s_bExchange;
  66. }
  67. HBRUSH CDLineProperty::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  68. {
  69. HBRUSH hbr = CPropertySheet::OnCtlColor(pDC, pWnd, nCtlColor);
  70. // TODO: Change any attributes of the DC here
  71. pDC->SetTextColor(RGB(0,100,255));
  72. pDC->SetBkColor(RGB(100,200,200));
  73. pDC->SelectObject(&brush);
  74. pDC->SetBkMode(OPAQUE);
  75. // TODO: Return a different brush if the default is not desired
  76. return hbr;
  77. }
  78. void CDLineProperty::OnPaint()
  79. {
  80. CPaintDC dc(this); // device context for painting
  81. // TODO: Add your message handler code here
  82. CPen pen;
  83. CRect rect;
  84. pen.CreatePen(PS_SOLID,20,RGB(156,200,255));
  85. CPen*oldPen=dc.SelectObject(&pen);
  86. this->GetClientRect(&rect);
  87. dc.SetBkColor(RGB(255,0,0));
  88. dc.SetBkMode(TRANSPARENT);
  89. dc.Rectangle(rect);
  90. dc.SetBkMode(OPAQUE);
  91. // Do not call CPropertySheet::OnPaint() for painting messages
  92. }
  93. void CDLineProperty::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
  94. {
  95. // TODO: Add your message handler code here and/or call default
  96. CPropertySheet::OnDrawItem(nIDCtl, lpDrawItemStruct);
  97. }
  98. void CDLineProperty::OnNcPaint()
  99. {
  100. // TODO: Add your message handler code here
  101. // Do not call for painting messages
  102. CPropertySheet::OnNcPaint();
  103. CPen pen;
  104. CRect rect;
  105. pen.CreatePen(PS_SOLID,2,RGB(0,0,255));
  106. CDC *pDC=GetWindowDC();
  107. this->GetWindowRect(rect);
  108. this->ScreenToClient(&rect);
  109. CPen*pOldPen=pDC->SelectObject(&pen);
  110. pDC->MoveTo(rect.right+1,rect.top+20);
  111. pDC->LineTo(rect.left+3,rect.top+20);
  112. pDC->LineTo(rect.left+4,rect.bottom+17);
  113. pDC->LineTo(rect.right+2,rect.bottom+17);
  114. pDC->LineTo(rect.right+2,rect.top+19);
  115. pDC->SelectObject(pOldPen);
  116. pen.DeleteObject();
  117. pen.CreatePen(PS_SOLID,1,RGB(255,0,0));
  118. pDC->SelectObject(&pen);
  119. pDC->MoveTo(rect.right-1,rect.top+21);
  120. pDC->LineTo(rect.left+5,rect.top+21);
  121. pDC->LineTo(rect.left+5,rect.bottom+16);
  122. pDC->LineTo(rect.right,rect.bottom+16);
  123. pDC->LineTo(rect.right,rect.top+20);
  124. }