var k,j:integer; begin with stringgrid1 do begin if RowCount=FixedRow+1 then begin for k:=0 to ColCount-1 do Celss[k,Row]:=''; exit; end; for k:=Row to RowCount-1 do for j:=0 to ColCount-1 do Cells[j,k]:=Celss[j,k+1]; if RowCount>FixedRow then RowCount:=RowCount-1; end; end;
k,j:integer;
begin
with stringgrid1 do
begin
if RowCount=FixedRow+1 then
begin
for k:=0 to ColCount-1 do
Celss[k,Row]:='';
exit;
end;
for k:=Row to RowCount-1 do
for j:=0 to ColCount-1 do
Cells[j,k]:=Celss[j,k+1];
if RowCount>FixedRow then
RowCount:=RowCount-1;
end;
end;
其中StringGrid1.Selection返回一个你所选择的矩形,仔细研究一下你会发现用处很大
记得给分哟