When using the TSTRINGGRID control, you need to display the line selection and easy to browse. It brought a gorowselect attribute. Set to true to highlight it, but this is not allowed to edit the content of a single cell.
In order to solve this problem, a variant method is used:
1. Add the following code in the OnseTelect event:
Gv_row: = arow; // gv_row is a global variable. Stringgrid1.repaint;
2. Add the following code in the OnDrawcell event:
IF (Arow = GV_ROW) THEN with STRINGGRID1.CANVAS Do Begin Brush.Color: = $ 00F0F0; // Sets the color of the dotted line DrawFocusRect (RECT);
Now, the selected unit rings have a blue dotted line surrounded, reaching the purpose of identifying the current line.