void COpticalDlg::OnTimer(UINT_PTR nIDEvent) { //获取当前时间 CTime tm=CTime::GetCurrentTime(); CString str,str1; CRect rect; //录入当前时间 str=tm.Format("%Y-%m-%d"); str1.Format("%2d:%2d:%2d",tm.GetHour(),tm.GetMinute(),tm.GetSecond()); ((CButton*)GetDlgItem(IDC_UPDATELOG))->GetWindowRect(&rect); ScreenToClient(&rect); //显示当前时间 CClientDC dc(this); dc.SetBkColor(RGB(73,99,243)); dc.TextOut(rect.left+25,rect.top-40,str); dc.TextOut(rect.left+35,rect.top-20,str1); CDialogEx::OnTimer(nIDEvent); }
窗口中动态显示时间
最新推荐文章于 2021-10-27 21:47:42 发布