Upstairs does not consider the situation when the StringGrid rank exceeds the display of the interface, your code is no problem. You use 100 lines to test and use the scroll bar to know.
What I said was to solve the "but when the unit or scroll bar is moved, those colors are displayed abnormally". For other problems, please refer to thestevevaicode.
Ha ha, the landlord, I'm sorry that I didn't have any problems during the test, including moving the scroll bar as you said, or the cell caused the color to be abnormal. None! Everything is very good! Ha ha!