You can use the following methods of CExtGridCell
to get the icon:
virtual CExtCmdIcon * IconGet();
const CExtCmdIcon * IconGet() const;
Please ensure you have overridden the first method because the second one is not virtual. The
IconGet()
virtual method is really invoked when the icon should be painted but it’s also invoked from the following virtual method:
virtual CSize IconGetSize() const;
You can override the
IconGetSize()
virtual method if you need to make the icon area smaller or larger. The icon area inside the grid cell is never used as a clickable or selectable area. So the icon is just a visual element. The
IconGetSize()
method is used for computing the size of the icon and the
CExtGridCell::OnPaintIcon()
method is used for painting the icon. You can implement the
IconGetSize()
and
CExtGridCell::OnPaintIcon()
virtual methods and draw something inside the icon area. For instance, the
CExtGridCellColor
color picker cell draws a color box instead of an icon and the
CExtGridCellFontFaceName
font name picker cell draws a font preview.