// ShowBakState.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "ShowBakState.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // ShowBakState dialog ShowBakState::ShowBakState(CWnd* pParent /*=NULL*/) : CDialog(ShowBakState::IDD, pParent) { //{{AFX_DATA_INIT(ShowBakState) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT } void ShowBakState::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(ShowBakState) // NOTE: the ClassWizard will add DDX and DDV calls here //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(ShowBakState, CDialog) //{{AFX_MSG_MAP(ShowBakState) ON_WM_PAINT() ON_WM_CTLCOLOR() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // ShowBakState message handlers void ShowBakState::OnPaint() { CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here CRect rc1,rc2,rc; GetDlgItem(IDC_STATIC8)->GetWindowRect(rc1); GetDlgItem(IDC_STATIC9)->GetWindowRect(rc2); ScreenToClient(rc1); ScreenToClient(rc2); CFont font;font.CreatePointFont (90, _T("宋体")); CFont *oldfont=dc.SelectObject (&font); int id[7]={IDC_STATIC1,IDC_STATIC2,IDC_STATIC3,IDC_STATIC4,IDC_STATIC5,IDC_STATIC6,IDC_STATIC7}; int dt=7-m_pArray->GetSize (); for(int i=0; i<7; i++) { GetDlgItem(id[i])->GetWindowRect(rc);ScreenToClient(rc); if(iSetWindowText("0000-00-00"); rc.top =rc1.top ; rc.bottom =rc1.bottom ; dc.FillSolidRect (rc, RGB(127,127,127)); rc.top =rc2.top ; rc.bottom =rc2.bottom ; dc.FillSolidRect (rc, RGB(127,127,127)); } else { GetDlgItem(id[i])->SetWindowText(m_pArray->ElementAt (i-dt).ElementAt (0)); rc.top =rc1.top ; rc.bottom =rc1.bottom ; if(m_pArray->ElementAt (i-dt).ElementAt (2)=="1") { dc.FillSolidRect (rc, RGB(0,255,0)); dc.DrawText("正常", rc, DT_CENTER|DT_VCENTER|DT_SINGLELINE); } else { dc.FillSolidRect (rc, RGB(255,0,0)); dc.DrawText("未备份", rc, DT_CENTER|DT_VCENTER|DT_SINGLELINE); } rc.top =rc2.top ; rc.bottom =rc2.bottom ; if(m_pArray->ElementAt (i-dt).ElementAt (1)=="1") { dc.FillSolidRect (rc, RGB(0,255,0)); dc.DrawText("正常", rc, DT_CENTER|DT_VCENTER|DT_SINGLELINE); } else { dc.FillSolidRect (rc, RGB(255,0,0)); dc.DrawText("未备份", rc, DT_CENTER|DT_VCENTER|DT_SINGLELINE); } } } dc.SelectObject (oldfont); // Do not call CDialog::OnPaint() for painting messages } BOOL ShowBakState::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CString str; str="\r\n\r\n 1. 客人资料与原片是否备份监测,资料与原片未备份有严重的丢失风险.\r\n 2. 系统检测七天内的备份状态,备份正常是绿色,未备份为红色.\r\n 3. 请确保备份盘为单独的一块物理硬盘(与原资料和照片不在同一块物理硬盘)\r\n 4. 请及时通知公司负责人或技术人员解决,如有需要请与经销商联系."; GetDlgItem(IDC_STATIC18)->SetWindowText(str); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } HBRUSH ShowBakState::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); // TODO: Change any attributes of the DC here if (nCtlColor==CTLCOLOR_STATIC && pWnd->GetDlgCtrlID ()==IDC_STATIC18) { pDC-> SetBkMode(TRANSPARENT); //设置字体背景为透明 return (HBRUSH)::GetStockObject(WHITE_BRUSH); // 设置背景色 } // TODO: Return a different brush if the default is not desired return hbr; }