ShowBakState.cpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. // ShowBakState.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "ShowBakState.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // ShowBakState dialog
  13. ShowBakState::ShowBakState(CWnd* pParent /*=NULL*/)
  14. : CDialog(ShowBakState::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(ShowBakState)
  17. // NOTE: the ClassWizard will add member initialization here
  18. //}}AFX_DATA_INIT
  19. }
  20. void ShowBakState::DoDataExchange(CDataExchange* pDX)
  21. {
  22. CDialog::DoDataExchange(pDX);
  23. //{{AFX_DATA_MAP(ShowBakState)
  24. // NOTE: the ClassWizard will add DDX and DDV calls here
  25. //}}AFX_DATA_MAP
  26. }
  27. BEGIN_MESSAGE_MAP(ShowBakState, CDialog)
  28. //{{AFX_MSG_MAP(ShowBakState)
  29. ON_WM_PAINT()
  30. ON_WM_CTLCOLOR()
  31. //}}AFX_MSG_MAP
  32. END_MESSAGE_MAP()
  33. /////////////////////////////////////////////////////////////////////////////
  34. // ShowBakState message handlers
  35. void ShowBakState::OnPaint()
  36. {
  37. CPaintDC dc(this); // device context for painting
  38. // TODO: Add your message handler code here
  39. CRect rc1,rc2,rc;
  40. GetDlgItem(IDC_STATIC8)->GetWindowRect(rc1);
  41. GetDlgItem(IDC_STATIC9)->GetWindowRect(rc2);
  42. ScreenToClient(rc1); ScreenToClient(rc2);
  43. CFont font;font.CreatePointFont (90, _T("宋体"));
  44. CFont *oldfont=dc.SelectObject (&font);
  45. int id[7]={IDC_STATIC1,IDC_STATIC2,IDC_STATIC3,IDC_STATIC4,IDC_STATIC5,IDC_STATIC6,IDC_STATIC7};
  46. int dt=7-m_pArray->GetSize ();
  47. for(int i=0; i<7; i++)
  48. {
  49. GetDlgItem(id[i])->GetWindowRect(rc);ScreenToClient(rc);
  50. if(i<dt)
  51. {
  52. GetDlgItem(id[i])->SetWindowText("0000-00-00");
  53. rc.top =rc1.top ;
  54. rc.bottom =rc1.bottom ;
  55. dc.FillSolidRect (rc, RGB(127,127,127));
  56. rc.top =rc2.top ;
  57. rc.bottom =rc2.bottom ;
  58. dc.FillSolidRect (rc, RGB(127,127,127));
  59. }
  60. else
  61. {
  62. GetDlgItem(id[i])->SetWindowText(m_pArray->ElementAt (i-dt).ElementAt (0));
  63. rc.top =rc1.top ;
  64. rc.bottom =rc1.bottom ;
  65. if(m_pArray->ElementAt (i-dt).ElementAt (2)=="1")
  66. {
  67. dc.FillSolidRect (rc, RGB(0,255,0));
  68. dc.DrawText("正常", rc, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
  69. }
  70. else
  71. {
  72. dc.FillSolidRect (rc, RGB(255,0,0));
  73. dc.DrawText("未备份", rc, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
  74. }
  75. rc.top =rc2.top ;
  76. rc.bottom =rc2.bottom ;
  77. if(m_pArray->ElementAt (i-dt).ElementAt (1)=="1")
  78. {
  79. dc.FillSolidRect (rc, RGB(0,255,0));
  80. dc.DrawText("正常", rc, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
  81. }
  82. else
  83. {
  84. dc.FillSolidRect (rc, RGB(255,0,0));
  85. dc.DrawText("未备份", rc, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
  86. }
  87. }
  88. }
  89. dc.SelectObject (oldfont);
  90. // Do not call CDialog::OnPaint() for painting messages
  91. }
  92. BOOL ShowBakState::OnInitDialog()
  93. {
  94. CDialog::OnInitDialog();
  95. // TODO: Add extra initialization here
  96. CString str;
  97. str="\r\n\r\n 1. 客人资料与原片是否备份监测,资料与原片未备份有严重的丢失风险.\r\n 2. 系统检测七天内的备份状态,备份正常是绿色,未备份为红色.\r\n 3. 请确保备份盘为单独的一块物理硬盘(与原资料和照片不在同一块物理硬盘)\r\n 4. 请及时通知公司负责人或技术人员解决,如有需要请与经销商联系.";
  98. GetDlgItem(IDC_STATIC18)->SetWindowText(str);
  99. return TRUE; // return TRUE unless you set the focus to a control
  100. // EXCEPTION: OCX Property Pages should return FALSE
  101. }
  102. HBRUSH ShowBakState::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  103. {
  104. HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
  105. // TODO: Change any attributes of the DC here
  106. if (nCtlColor==CTLCOLOR_STATIC && pWnd->GetDlgCtrlID ()==IDC_STATIC18)
  107. {
  108. pDC-> SetBkMode(TRANSPARENT); //设置字体背景为透明
  109. return (HBRUSH)::GetStockObject(WHITE_BRUSH); // 设置背景色
  110. }
  111. // TODO: Return a different brush if the default is not desired
  112. return hbr;
  113. }