Curwin.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // Curwin.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "newclient.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. END_MESSAGE_MAP()
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CCurwin message handlers
  41. int CCurwin::OnCreate(LPCREATESTRUCT lpCreateStruct)
  42. {
  43. if (CDialog::OnCreate(lpCreateStruct) == -1)
  44. return -1;
  45. // TODO: Add your specialized creation code here
  46. return 0;
  47. }
  48. void CCurwin::OnMove(int x, int y)
  49. {
  50. CDialog::OnMove(x, y);
  51. // TODO: Add your message handler code here
  52. }
  53. void CCurwin::OnPaint()
  54. {
  55. CPaintDC dc(this); // device context for painting
  56. // TODO: Add your message handler code here
  57. CRect rcBounds;
  58. GetClientRect(&rcBounds);
  59. CPen penWhite;
  60. penWhite.CreatePen(PS_SOLID, 1, RGB(0,255,0));
  61. CPen* pOldPen = dc.SelectObject(&penWhite);
  62. dc.MoveTo(rcBounds.left, rcBounds.top);
  63. dc.LineTo(rcBounds.right-1,rcBounds.top);
  64. dc.LineTo(rcBounds.right-1,rcBounds.bottom-1);
  65. dc.LineTo(rcBounds.left, rcBounds.bottom-1);
  66. dc.LineTo(rcBounds.left, rcBounds.top);
  67. dc.SelectObject(pOldPen);
  68. m_black.MoveWindow(rcBounds.left+1,rcBounds.top+1,rcBounds.Width()-2,rcBounds.Height()-2);
  69. }
  70. HBRUSH CCurwin::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  71. {
  72. HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
  73. // TODO: Change any attributes of the DC here
  74. if(ClientParam.m_bUseCard)
  75. {
  76. return hBrush;
  77. }
  78. // TODO: Return a different brush if the default is not desired
  79. return hbr;
  80. }
  81. void CCurwin::OnStnClickedBlack()
  82. {
  83. // TODO: 在此添加控件通知处理程序代码
  84. }