📄 datetime.cpp
字号:
// DateTime.cpp : implementation file
//
#include "stdafx.h"
#include "MoinorCentre.h"
#include "DateTime.h"
#include"PictureList.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDateTime dialog
CDateTime::CDateTime(CWnd* pParent /*=NULL*/)
: CDialog(CDateTime::IDD, pParent)
{
//{{AFX_DATA_INIT(CDateTime)
m_begindate = COleDateTime::GetCurrentTime();
m_begintime = COleDateTime::GetCurrentTime();
m_enddate = COleDateTime::GetCurrentTime();
m_endtime = COleDateTime::GetCurrentTime();
//}}AFX_DATA_INIT
}
void CDateTime::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDateTime)
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER1, m_begindate);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER2, m_begintime);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER3, m_enddate);
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER4, m_endtime);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDateTime, CDialog)
//{{AFX_MSG_MAP(CDateTime)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDateTime message handlers
void CDateTime::OnOK()
{
// TODO: Add extra validation here
UpdateData();
((CPictureList*)GetParent())->m_begintime.SetDateTime(m_begindate.GetYear(),m_begindate.GetMonth(),m_begindate.GetDay(),m_begintime.GetHour(),m_begintime.GetMinute(),m_begintime.GetSecond());
((CPictureList*)GetParent())->m_endtime.SetDateTime(m_enddate.GetYear(),m_enddate.GetMonth(),m_enddate.GetDay(),m_endtime.GetHour(),m_endtime.GetMinute(),m_endtime.GetSecond());
CDialog::OnOK();
}
HBRUSH CDateTime::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor==CTLCOLOR_DLG)
{
return m_brush;
}
if(nCtlColor == CTLCOLOR_STATIC)
{ pDC->SetBkMode(0);
pDC->SetTextColor(RGB(255,100,70));
hbr = (HBRUSH)::GetStockObject(NULL_BRUSH);
return hbr;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -