private
ActRow: Integer;//StringGrid1のアクティブ列情報
procedure TForm1.Button1Click(Sender: TObject);
var
sList: TStringList;
begin
if ActRow = StringGrid1.RowCount - 1 then
Exit;
sList := TStringList.Create;
try
sList.Assign(StringGrid1.Rows[ActRow]);
//Colが4つの場合(必要数に応じてコーディングが必要)
StringGrid1.Cells[0,ActRow] := StringGrid1.Cells[0,ActRow+1];
StringGrid1.Cells[1,ActRow] := StringGrid1.Cells[1,ActRow+1];
StringGrid1.Cells[2,ActRow] := StringGrid1.Cells[2,ActRow+1];
StringGrid1.Cells[3,ActRow] := StringGrid1.Cells[3,ActRow+1];
StringGrid1.Rows[ActRow+1].Assign(sList);
finally
sList.Free;
end;
if ActRow <> StringGrid1.RowCount - 1 then
ActRow := ActRow + 1;
StringGrid1.Row := ActRow;
end;
|