First, you should get rectangular cell coordinates in the grid control’s client coordinate system:
CExtGridWnd & wndGrid = . . .
LONG nColNo = . . .
LONG nRowNo = . . .
CRect rcCellLocation;
if( ! wndGrid.GridCellRectsGet(
nColNo,
nRowNo,
0,
0,
NULL,
&rcCellLocation
)
)
return . . .
The
CExtGridWnd::GridCellRectsGet()
method returns
true
> if the
rcCellLocation
rectangle was filled with correct cell rectangle coordinates in the grid’s client coordinate system. This method returns
false</codde> if it is not possible to compute cell coordinates (cell at column <code>nColNo
column and row
nRowNo
is outside the visible cell range or method parameters are invalid).
Then you should invalidate the part of the grid control which contains the cell at
nColNo
and
nRowNo
wndGrid.InvalidateRect( &rcCellLocation );
This code delays repainting of grid control’s part which contains the specified grid cell. If you don not need delayed repainting and grid control’s surface on the screen should be updated immediately, then the next line of code should be
wndGrid.UpdateWindow();
If you want to repaint several cells immediately, you should invoke the
UpdateWindow()
method only once after all the cells were invalidated.