TimeOutDlg.cpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. // TimeOutDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "TimeOutDlg.h"
  6. /////////////////////////////////////////////////////////////////////////////
  7. // TimeOutDlg dialog
  8. TimeOutDlg::TimeOutDlg(CWnd* pParent /*=NULL*/)
  9. : CDialog(TimeOutDlg::IDD, pParent)
  10. {
  11. //{{AFX_DATA_INIT(TimeOutDlg)
  12. m_psw2 = _T("");
  13. //}}AFX_DATA_INIT
  14. }
  15. void TimeOutDlg::DoDataExchange(CDataExchange* pDX)
  16. {
  17. CDialog::DoDataExchange(pDX);
  18. //{{AFX_DATA_MAP(TimeOutDlg)
  19. DDX_Text(pDX, IDC_EDIT1, m_psw2);
  20. //}}AFX_DATA_MAP
  21. }
  22. BEGIN_MESSAGE_MAP(TimeOutDlg, CDialog)
  23. //{{AFX_MSG_MAP(TimeOutDlg)
  24. ON_WM_PAINT()
  25. //}}AFX_MSG_MAP
  26. END_MESSAGE_MAP()
  27. /////////////////////////////////////////////////////////////////////////////
  28. // TimeOutDlg message handlers
  29. void TimeOutDlg::OnPaint()
  30. {
  31. CPaintDC dc(this); // device context for painting
  32. // TODO: Add your message handler code here
  33. CBrush brush(RGB(235,235,235));
  34. CRect rc;
  35. GetClientRect(rc);
  36. dc.FillRect (rc, &brush);
  37. rc.DeflateRect (2,2);
  38. brush.DeleteObject ();
  39. brush.CreateSolidBrush (RGB(229,54,189));
  40. dc.FillRect (rc, &brush);
  41. rc.left +=10;
  42. rc.top +=20;
  43. Graphics graph(dc.GetSafeHdc());
  44. RectF layoutRect(rc.left , rc.top, rc.Width (), rc.Height ());
  45. StringFormat format;
  46. format.SetAlignment(StringAlignmentNear );
  47. SolidBrush *Brush=new SolidBrush(Color(255,255,255,255));
  48. CString str;
  49. str="温馨提示:";
  50. int leng=GetLengthEx(str);
  51. BSTR bstr= str.AllocSysString();
  52. Gdiplus::Font *g_TimerFont=new Gdiplus::Font(L"黑体", 13);
  53. graph.SetTextRenderingHint(TextRenderingHintAntiAlias);
  54. graph.DrawString(
  55. bstr,
  56. leng,
  57. g_TimerFont,
  58. layoutRect,
  59. &format,
  60. Brush);
  61. SysFreeString(bstr);
  62. rc.top +=30;
  63. rc.left +=40;
  64. RectF layoutRect2(rc.left , rc.top, rc.Width (), rc.Height ());
  65. int hour,minute;
  66. int second=::GetTickCount ()-m_ticks;
  67. second/=1000;
  68. hour=second/3600;
  69. second-=3600*hour;
  70. minute=second/60;
  71. str.Format("尊贵的客人, 您选片已超过 %d 小时, %d 分钟!", hour, minute);
  72. leng=GetLengthEx(str);
  73. bstr= str.AllocSysString();
  74. graph.SetTextRenderingHint(TextRenderingHintAntiAlias);
  75. graph.DrawString(
  76. bstr,
  77. leng,
  78. g_TimerFont,
  79. layoutRect2,
  80. &format,
  81. Brush);
  82. SysFreeString(bstr);
  83. GetDlgItem(IDC_EDIT1)->GetWindowRect(rc);
  84. ScreenToClient(rc);
  85. rc.right=rc.left;
  86. rc.left =0;
  87. RectF layoutRect3(rc.left , rc.top, rc.Width (), rc.Height ());
  88. str="密码:";
  89. leng=GetLengthEx(str);
  90. StringFormat format2;
  91. format2.SetAlignment(StringAlignmentFar );
  92. bstr= str.AllocSysString();
  93. graph.SetTextRenderingHint(TextRenderingHintAntiAlias);
  94. graph.DrawString(
  95. bstr,
  96. leng,
  97. g_TimerFont,
  98. layoutRect3,
  99. &format2,
  100. Brush);
  101. delete Brush;
  102. delete g_TimerFont;
  103. SysFreeString(bstr);
  104. // Do not call CDialog::OnPaint() for painting messages
  105. }
  106. void TimeOutDlg::OnOK()
  107. {
  108. // TODO: Add extra validation here
  109. UpdateData();
  110. CString psw1=g_cominfoarray.ElementAt(0).ElementAt(98);
  111. psw1.TrimLeft();
  112. psw1.TrimRight();
  113. m_psw2.TrimLeft();
  114. m_psw2.TrimRight();
  115. if(psw1!=m_psw2)
  116. {
  117. AfxMessageBox("密码错误!");
  118. return;
  119. }
  120. CDialog::OnOK();
  121. }
  122. void TimeOutDlg::OnCancel()
  123. {
  124. // TODO: Add extra cleanup here
  125. }
  126. BOOL TimeOutDlg::OnInitDialog()
  127. {
  128. CDialog::OnInitDialog();
  129. // TODO: Add extra initialization here
  130. return 0; // return TRUE unless you set the focus to a control
  131. // EXCEPTION: OCX Property Pages should return FALSE
  132. }