DLineProperty.cpp
上传用户:qiye66671
上传日期:2009-12-10
资源大小:182k
文件大小:4k
源码类别:

绘图程序

开发平台:

C/C++

  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. }
  36. CDLineProperty::~CDLineProperty()
  37. {
  38. }
  39. BEGIN_MESSAGE_MAP(CDLineProperty, CPropertySheet)
  40. //{{AFX_MSG_MAP(CDLineProperty)
  41. ON_WM_CLOSE()
  42. ON_WM_NCLBUTTONDBLCLK()
  43. ON_WM_CTLCOLOR()
  44. ON_WM_PAINT()
  45. ON_WM_DRAWITEM()
  46. ON_WM_NCPAINT()
  47. //}}AFX_MSG_MAP
  48. END_MESSAGE_MAP()
  49. /////////////////////////////////////////////////////////////////////////////
  50. // CDLineProperty message handlers
  51. void CDLineProperty::OnClose() 
  52. {
  53. // TODO: Add your message handler code here and/or call default
  54. this->ShowWindow(false);
  55. //CPropertySheet::OnClose();
  56. }
  57. void CDLineProperty::OnNcLButtonDblClk(UINT nHitTest, CPoint point) 
  58. {
  59. // TODO: Add your message handler code here and/or call default
  60.  CPropertySheet::OnNcLButtonDblClk(nHitTest, point);
  61.      
  62.      static BOOL s_bExchange=true;
  63.  CRect rect;
  64.  this->GetWindowRect(&rect);
  65.  s_bExchange?this->SetWindowPos(&wndTop,0,0,rect.Width(),rect.Height()/13+1,SWP_NOMOVE):
  66.              this->SetWindowPos(&wndTop,0,0,rect.Width(),(rect.Height()-1)*13,SWP_NOMOVE);
  67.  s_bExchange=!s_bExchange;
  68. }
  69. HBRUSH CDLineProperty::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
  70. {
  71. HBRUSH hbr = CPropertySheet::OnCtlColor(pDC, pWnd, nCtlColor);
  72. // TODO: Change any attributes of the DC here
  73.    pDC->SetTextColor(RGB(0,100,255));
  74.    pDC->SetBkColor(RGB(100,200,200));
  75.    pDC->SelectObject(&brush);
  76.    pDC->SetBkMode(OPAQUE);
  77. // TODO: Return a different brush if the default is not desired
  78. return hbr;
  79. }
  80. void CDLineProperty::OnPaint() 
  81. {
  82. CPaintDC dc(this); // device context for painting
  83. // TODO: Add your message handler code here
  84.  CPen pen;
  85.      CRect rect;
  86.  pen.CreatePen(PS_SOLID,20,RGB(156,200,255));
  87.      CPen*oldPen=dc.SelectObject(&pen);
  88.     
  89.     this->GetClientRect(&rect);
  90.     dc.SetBkColor(RGB(255,0,0));
  91.     dc.SetBkMode(TRANSPARENT);
  92.      dc.Rectangle(rect);
  93.  
  94.      dc.SetBkMode(OPAQUE);
  95.      
  96. // Do not call CPropertySheet::OnPaint() for painting messages
  97. }
  98. void CDLineProperty::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) 
  99. {
  100. // TODO: Add your message handler code here and/or call default
  101. CPropertySheet::OnDrawItem(nIDCtl, lpDrawItemStruct);
  102. }
  103. void CDLineProperty::OnNcPaint() 
  104. {
  105. // TODO: Add your message handler code here
  106. // Do not call  for painting messages
  107.     CPropertySheet::OnNcPaint();
  108.     CPen pen;
  109.     CRect rect;
  110. pen.CreatePen(PS_SOLID,2,RGB(0,0,255));
  111.     CDC *pDC=GetWindowDC();
  112. this->GetWindowRect(rect);
  113. this->ScreenToClient(&rect);
  114.     CPen*pOldPen=pDC->SelectObject(&pen);
  115. pDC->MoveTo(rect.right+1,rect.top+20);
  116.     pDC->LineTo(rect.left+3,rect.top+20);
  117. pDC->LineTo(rect.left+4,rect.bottom+17);
  118. pDC->LineTo(rect.right+2,rect.bottom+17);
  119. pDC->LineTo(rect.right+2,rect.top+19);
  120.     
  121. pDC->SelectObject(pOldPen);
  122. pen.DeleteObject();
  123. pen.CreatePen(PS_SOLID,1,RGB(255,0,0));
  124. pDC->SelectObject(&pen);
  125.     
  126. pDC->MoveTo(rect.right-1,rect.top+21);
  127.     pDC->LineTo(rect.left+5,rect.top+21);
  128. pDC->LineTo(rect.left+5,rect.bottom+16);
  129. pDC->LineTo(rect.right,rect.bottom+16);
  130. pDC->LineTo(rect.right,rect.top+20);
  131. }