Date Time Picker control for the MFC Grid Control






4.67/5 (6 votes)
A DateTime control for editing date or time values inplace in the MFC Grid Control
Introduction
This is a simple drop-in cell class for Chris Maunder's MFC Grid Control. The cell's class is CGridCellDateTime
and is used in exactly the same way as other grid cell types.
The edit window that is created when the cell goes into edit mode is of type CDateTimeCtrl
(so you need at least IE3 installed on your system for it to run)
Possible usage
MyDialog::OnInitDialog() { ... m_Grid.SetRowCount(44); m_Grid.SetColumnCount(22); m_Grid.SetFixedRowCount(); for (int i =1; i <44; i++) { m_Grid.SetCellType(i, 0, RUNTIME_CLASS(CGridCellDateTime)); ((CGridCellDateTime*) m_Grid.GetCell(i, 0))->Init(DTS_SHORTDATEFORMAT); m_Grid.SetCellType(i, 1, RUNTIME_CLASS(CGridCellDateTime)); ((CGridCellDateTime*) m_Grid.GetCell(i, 1))->Init(DTS_TIMEFORMAT); } ... }