Despite the fact that there are many people with more capable abilities, since you have not received any answers, I thought I would try.
I do not know how to make a component for you. However, when you control a click on a cell, the OnSelectedCell event is raised. (I just tested this.) You can put the code in an event handler that adds the row and column of the cell to the list that you save from the selected rows and columns. Then, in the OnDrawCell event, select the cell:
procedure TForm1.StringGrid1DrawCell( Sender: TObject; ACol: Integer; ARow: Integer; Rect: TRect; State: TGridDrawState); begin if CellSelected( ARow, ACol) then // you write CellSelected() to refer to the list you're keeping begin StringGrid1.Canvas.Brush.Color := clYellow; StringGrid1.Canvas.FillRect(Rect); StringGrid1.Canvas.TextOut(Rect.Left,Rect.Top,StringGrid1.Cells[ACol,ARow]); end; end;
source share