📄 dateinputdlg.cpp
字号:
// DateInputDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Operat.h"
#include "DateInputDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDateInputDlg dialog
CDateInputDlg::CDateInputDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDateInputDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CDateInputDlg)
//}}AFX_DATA_INIT
}
void CDateInputDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDateInputDlg)
DDX_Control(pDX, IDC_SPIN_MINUTE, m_nSpinMinute);
DDX_Control(pDX, IDC_SPIN_HOUR, m_nSpinHour);
DDX_Control(pDX, IDC_EDIT_MINUTE, m_nMinute);
DDX_Control(pDX, IDC_EDIT_HOUR, m_nHour);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDateInputDlg, CDialog)
//{{AFX_MSG_MAP(CDateInputDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDateInputDlg message handlers
BOOL CDateInputDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CTime nTime;
nTime=m_nCurTime;
if (!m_nDateTimeCtrl.Create(WS_CHILD|WS_VISIBLE|WS_BORDER,CRect(0,15,110,45),this,IDC_DATEINPUT_CTRL))
{
TRACE0("Failed to create print button !\n");
}
m_nDateTimeCtrl.SetTime(&nTime);
m_nSpinHour.SetBuddy(&m_nHour);
m_nSpinHour.SetRange(0,23);
m_nSpinHour.SetPos(nTime.GetHour());
m_nSpinMinute.SetBuddy(&m_nMinute);
m_nSpinMinute.SetRange(0,59);
m_nSpinMinute.SetPos(nTime.GetMinute());
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDateInputDlg::OnOK()
{
// TODO: Add extra validation here
CTime nTime;
m_nDateTimeCtrl.GetTime(nTime);
m_nCurTime=nTime.GetTime()-nTime.GetHour()*3600-nTime.GetMinute()*60+m_nSpinHour.GetPos()*3600+m_nSpinMinute.GetPos()*60-nTime.GetSecond();
CDialog::OnOK();
}
void CDateInputDlg::SetInitTime(long nTime)
{
m_nCurTime=nTime;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -