The sample shows an opportunity of use of
controls of cells, and also changes of the data in cells.
Class CGridView is determined from parent class CALXGridView. In his constructor are added column (function AddCol()) and define
type control (function DefineColCtrl()). Cells of one of column
are defined as a cell containing the image (function DefineImage())
CGridView::CGridView()
{
// Text
DefineColCtrl(AddCol(80,"LeftText", ACFF_LEFT,
AHFF_LEFT),GA_EDITCTRL,WS_CHILD | ES_LEFT | ES_AUTOHSCROLL);
...
// ImageList
int nCol = AddCol(80,"Bitmap
&& Text", ACFF_LEFT, AHFF_LEFT);
DefineColCtrl(nCol,GA_EDITCTRL,WS_CHILD | ES_LEFT | ES_AUTOHSCROLL);
DefineImage(nCol,7,7,DIT_IMGLIST);
// CheckBox
DefineColCtrl(AddCol(90,"CheckBox3State", ACFF_CENTER,
AHFF_CENTER, DFC_BUTTON, DFCS_BUTTON3STATE | DFCS_FLAT),GA_BUTTONCTRL,WS_CHILD |
BS_AUTO3STATE | BS_FLAT);
...
// ComboBox
DefineColCtrl(AddCol(150,"Hide DropDownComboBox", ACFF_LEFT,
AHFF_LEFT),GA_COMBOBOXCTRL,WS_CHILD | CBS_DROPDOWN | WS_VSCROLL);
...
SetGridRowCount(0);
VERIFY(m_ImageList.Create(IDB_BITMAP_IMGLIST, 7, 1,
(COLORREF)0x808000));
}
Also virtual functions CreateCellCtrl() (dropping out lists are
filled), GetImageListDrawParams() (returns the index on the image of a cell and his
parameters), GetCellData() (returns the data cells necessary for display) and
OnSaveCellData() (keeps changes) are redefined. |