The original version of the sample in question is available here (we renamed it to SimpleGridOnDialog). The button cell in your message is controlled by the CMyStartStopCell
class, which recomputes its size and re-paints its built-in ellipsis button in the CExtGridCell
object. To make this button centered, you should add the following virtual method to the CMyStartStopCell
class:
virtual void OnCalcLayout(
DWORD dwCellStyle,
DWORD dwCellStyleEx,
CRect & rcCellRest,
CRect & rcCellText,
CRect & rcFocusArrow,
CRect & rcIcon,
CRect & rcCheck,
CRect & rcSortArrow,
CRect & rcUpdownButtonTop,
CRect & rcUpdownButtonBottom,
CRect & rcDropdownButton,
CRect & rcEllipsisButton,
CSize sizeFocusArrow,
CSize sizeIcon,
CSize sizeCheck,
CSize sizeSortArrow,
INT nExtentUpdownButton,
INT nExtentDropdownButton,
INT nExtentEllipsisButton,
INT & nFocusGlyphType,
const CExtGridWnd & wndGrid,
CDC & dc,
LONG nVisibleColNo,
LONG nVisibleRowNo,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType,
DWORD dwAreaFlags,
DWORD dwHelperPaintFlags
) const
{
ASSERT_VALID( this );
CRect rc = rcCellRest;
CExtGridCell::OnCalcLayout(
dwCellStyle,
dwCellStyleEx,
rcCellRest,
rcCellText,
rcFocusArrow,
rcIcon,
rcCheck,
rcSortArrow,
rcUpdownButtonTop,
rcUpdownButtonBottom,
rcDropdownButton,
rcEllipsisButton,
sizeFocusArrow,
sizeIcon,
sizeCheck,
sizeSortArrow,
nExtentUpdownButton,
nExtentDropdownButton,
nExtentEllipsisButton,
nFocusGlyphType,
wndGrid,
dc,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
dwAreaFlags,
dwHelperPaintFlags
);
rcEllipsisButton.OffsetRect(
- ( rc.Width() - rcEllipsisButton.Width() ) / 2,
( rc.Height() - rcEllipsisButton.Height() ) / 2
);
}