Curwin.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. // Curwin.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "StoneU_HC_OCX.h"
  5. #include "Curwin.h"
  6. #include ".\curwin.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CCurwin dialog
  14. extern HBRUSH hBrush;
  15. extern CLIENTPARAM ClientParam;
  16. CCurwin::CCurwin(CWnd* pParent /*=NULL*/)
  17. : CDialog(CCurwin::IDD, pParent)
  18. {
  19. //{{AFX_DATA_INIT(CCurwin)
  20. // NOTE: the ClassWizard will add member initialization here
  21. //}}AFX_DATA_INIT
  22. }
  23. void CCurwin::DoDataExchange(CDataExchange* pDX)
  24. {
  25. CDialog::DoDataExchange(pDX);
  26. //{{AFX_DATA_MAP(CCurwin)
  27. DDX_Control(pDX, IDC_BLACK, m_black);
  28. //}}AFX_DATA_MAP
  29. }
  30. BEGIN_MESSAGE_MAP(CCurwin, CDialog)
  31. //{{AFX_MSG_MAP(CCurwin)
  32. ON_WM_CREATE()
  33. ON_WM_MOVE()
  34. ON_WM_PAINT()
  35. ON_WM_CTLCOLOR()
  36. //}}AFX_MSG_MAP
  37. ON_STN_CLICKED(IDC_BLACK, OnStnClickedBlack)
  38. ON_WM_ERASEBKGND()
  39. END_MESSAGE_MAP()
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CCurwin message handlers
  42. int CCurwin::OnCreate(LPCREATESTRUCT lpCreateStruct)
  43. {
  44. if (CDialog::OnCreate(lpCreateStruct) == -1)
  45. return -1;
  46. // TODO: Add your specialized creation code here
  47. return 0;
  48. }
  49. void CCurwin::OnMove(int x, int y)
  50. {
  51. CDialog::OnMove(x, y);
  52. // TODO: Add your message handler code here
  53. }
  54. void CCurwin::OnPaint()
  55. {
  56. CPaintDC dc(this); // device context for painting
  57. // TODO: Add your message handler code here
  58. CRect rcBounds;
  59. GetClientRect(&rcBounds);
  60. CPen penWhite;
  61. penWhite.CreatePen(PS_SOLID, 1, RGB(0,255,0));
  62. CPen* pOldPen = dc.SelectObject(&penWhite);
  63. dc.MoveTo(rcBounds.left, rcBounds.top);
  64. dc.LineTo(rcBounds.right-1,rcBounds.top);
  65. dc.LineTo(rcBounds.right-1,rcBounds.bottom-1);
  66. dc.LineTo(rcBounds.left, rcBounds.bottom-1);
  67. dc.LineTo(rcBounds.left, rcBounds.top);
  68. dc.SelectObject(pOldPen);
  69. m_black.MoveWindow(rcBounds.left+1,rcBounds.top+1,rcBounds.Width()-2,rcBounds.Height()-2);
  70. }
  71. HBRUSH CCurwin::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  72. {
  73. HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
  74. // TODO: Change any attributes of the DC here
  75. if(ClientParam.m_bUseCard)
  76. {
  77. return hBrush;
  78. }
  79. // TODO: Return a different brush if the default is not desired
  80. return hbr;
  81. }
  82. void CCurwin::OnStnClickedBlack()
  83. {
  84. // TODO: 在此添加控件通知处理程序代码
  85. }
  86. BOOL CCurwin::OnEraseBkgnd(CDC* pDC)
  87. {
  88. CBrush brush;
  89. CRect rect, rect2;
  90. COLORREF rgbBackGnd = RGB( 0,0,0 ); // RGB( 59,61,63 );
  91. GetWindowRect(&rect);
  92. ScreenToClient(&rect);
  93. brush.CreateSolidBrush(rgbBackGnd);
  94. pDC->FillRect(rect,&brush);
  95. DeleteObject( brush );
  96. return true;
  97. //return CDialog::OnEraseBkgnd(pDC);
  98. }