MFC Grid Control - how to add an icon
-
J want to add an icon i one of the column i my CGridCtrl. Firts i add a class: class MGrid : public CGridCtrl { ... public: CImageList m_ImageList; } In my function Init_grid: m_ImageList.Create(MAKEINTRESOURCE(IDB_IMAGES), 16, 1, RGB(255,255,255)); SetImageList(&m_ImageList); (IDB_IMAGES is a smallicon.bmp file) Now I want to add an icon in 2 column of my grid: void MGrid::Draw_icon(int ARow) { int ACol = 0; int ilosc_col = GetColumnCount(); CString str = ""; GV_ITEM Item; for(ACol = 1; ACol <= ilosc_col; ACol++) { Item.row = ARow; Item.col = ACol; if(ACol == 2) { Item.mask = GVIF_TEXT; str.Format(_T("Column %d"), ACol); Item.strText = str; Item.iImage = 1; Item.mask |= (GVIF_IMAGE); SetItem(&Item); } } What I see is a string "Column 1" (..n) but there is no image in the column. Can you help me? Regards mwgomez Poland