fontoholic a écrit:
> Hi
>
> Can anyone tell me how I can highlight a single cell when the user
clicks on
> it? I have tried lots of methods but they all seem to highlight the
complete
> row. The closest I have come is to use CellClick to get the row and
column
> index, then pass that onto CellBackgroundPaint.
Here's an example (you were almost right):
In the cellbackground paint event
if column=MyStoredColumn then Return False 'Allow the OS to do
standard highlight for the selected column
//For other columns, empty the row:
g.ForeColor=RGB(255,255,255)
g.FillRect 0,0,g.Width,g.Height
return true 'Prevent the os to highlight the cell
In the CellTextPaint event:
g.ForeColor=RGB(0,0,0) 'g keeps the colour given in the
CellBackgroundPaint event, so we set it to black
g.DrawString me.Cell(row,column),x,y 'and we draw the content of the
cell
Return True
HTH


|