Delphi DBGrid类控件定位到某一行,并更改为选中状态。

grDirectory.DataSource.DataSet.Locate('StepNo', StrToInt(stepList[i]), []);

grDirectory.ClearSelection;

grDirectory.FocusedNode.Selected := True;