123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- // TimeOutDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "TimeOutDlg.h"
-
- /////////////////////////////////////////////////////////////////////////////
- // TimeOutDlg dialog
- TimeOutDlg::TimeOutDlg(CWnd* pParent /*=NULL*/)
- : CDialog(TimeOutDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(TimeOutDlg)
- m_psw2 = _T("");
- //}}AFX_DATA_INIT
- }
- void TimeOutDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(TimeOutDlg)
- DDX_Text(pDX, IDC_EDIT1, m_psw2);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(TimeOutDlg, CDialog)
- //{{AFX_MSG_MAP(TimeOutDlg)
- ON_WM_PAINT()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // TimeOutDlg message handlers
- void TimeOutDlg::OnPaint()
- {
- CPaintDC dc(this); // device context for painting
-
- // TODO: Add your message handler code here
- CBrush brush(RGB(235,235,235));
- CRect rc;
- GetClientRect(rc);
- dc.FillRect (rc, &brush);
- rc.DeflateRect (2,2);
- brush.DeleteObject ();
- brush.CreateSolidBrush (RGB(229,54,189));
- dc.FillRect (rc, &brush);
- rc.left +=10;
- rc.top +=20;
- Graphics graph(dc.GetSafeHdc());
- RectF layoutRect(rc.left , rc.top, rc.Width (), rc.Height ());
- StringFormat format;
- format.SetAlignment(StringAlignmentNear );
- SolidBrush *Brush=new SolidBrush(Color(255,255,255,255));
- CString str;
- str="温馨提示:";
- int leng=GetLengthEx(str);
- BSTR bstr= str.AllocSysString();
- Gdiplus::Font *g_TimerFont=new Gdiplus::Font(L"黑体", 13);
- graph.SetTextRenderingHint(TextRenderingHintAntiAlias);
- graph.DrawString(
- bstr,
- leng,
- g_TimerFont,
- layoutRect,
- &format,
- Brush);
- SysFreeString(bstr);
- rc.top +=30;
- rc.left +=40;
- RectF layoutRect2(rc.left , rc.top, rc.Width (), rc.Height ());
- int hour,minute;
- int second=::GetTickCount ()-m_ticks;
- second/=1000;
- hour=second/3600;
- second-=3600*hour;
- minute=second/60;
- str.Format("尊贵的客人, 您选片已超过 %d 小时, %d 分钟!", hour, minute);
- leng=GetLengthEx(str);
- bstr= str.AllocSysString();
- graph.SetTextRenderingHint(TextRenderingHintAntiAlias);
- graph.DrawString(
- bstr,
- leng,
- g_TimerFont,
- layoutRect2,
- &format,
- Brush);
- SysFreeString(bstr);
- GetDlgItem(IDC_EDIT1)->GetWindowRect(rc);
- ScreenToClient(rc);
- rc.right=rc.left;
- rc.left =0;
-
- RectF layoutRect3(rc.left , rc.top, rc.Width (), rc.Height ());
-
- str="密码:";
- leng=GetLengthEx(str);
-
- StringFormat format2;
- format2.SetAlignment(StringAlignmentFar );
- bstr= str.AllocSysString();
- graph.SetTextRenderingHint(TextRenderingHintAntiAlias);
- graph.DrawString(
- bstr,
- leng,
- g_TimerFont,
- layoutRect3,
- &format2,
- Brush);
- delete Brush;
- delete g_TimerFont;
- SysFreeString(bstr);
-
- // Do not call CDialog::OnPaint() for painting messages
- }
- void TimeOutDlg::OnOK()
- {
- // TODO: Add extra validation here
- UpdateData();
- CString psw1=g_cominfoarray.ElementAt(0).ElementAt(98);
- psw1.TrimLeft();
- psw1.TrimRight();
- m_psw2.TrimLeft();
- m_psw2.TrimRight();
- if(psw1!=m_psw2)
- {
- AfxMessageBox("密码错误!");
- return;
- }
- CDialog::OnOK();
- }
- void TimeOutDlg::OnCancel()
- {
- // TODO: Add extra cleanup here
-
- }
- BOOL TimeOutDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
-
- return 0; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
|