是stringgrid1.Row例子如下:procedure TForm1.StringGrid1DblClick(Sender: TObject); begin application.MessageBox(pchar(inttostr(stringgrid1.Row)),'当前行',mb_ok);end;
程序实现代码: var row1,row2:integer; i:integer; strList:TStringList; begin row1:=stringgrid1.Row; StringGrid2.RowCount:=StringGrid2.RowCount+1; row2:=StringGrid2.rowCount; strList:=TStringList.Create; try for i:=0 to StringGrid1.ColCount-1 do strList.Add(StringGrid1.Cells[i,row1]); StringGrid2.Rows[row2-1].AddStrings(strList); finally strList.Free; end; end;
begin
application.MessageBox(pchar(inttostr(stringgrid1.Row)),'当前行',mb_ok);end;
var
row1,row2:integer;
i:integer;
strList:TStringList;
begin
row1:=stringgrid1.Row;
StringGrid2.RowCount:=StringGrid2.RowCount+1;
row2:=StringGrid2.rowCount;
strList:=TStringList.Create;
try
for i:=0 to StringGrid1.ColCount-1 do
strList.Add(StringGrid1.Cells[i,row1]);
StringGrid2.Rows[row2-1].AddStrings(strList);
finally
strList.Free;
end;
end;