不知你是不是想要这个,以下功能是将一个StringGrid(Ztsrc)中选中的一行给另外一个stringGrid(ZtDst),并将第一个StringGrid(Ztsrc)中选中的那行删除。
var
RowSelect:integer;
i:integer;
begin
RowSelect:=ZtSrc.Row;
if ZtDst.Cells[0,0]='' then
ZtDst.Rows[0].Text:=ZtSrc.Rows[RowSelect].Text
else
begin
ZtDst.RowCount:=ZtDst.RowCount+1;
ZtDst.Rows[ZtDst.RowCount-1].Text:=ZtSrc.Rows[RowSelect].Text;
end;
if ZtSrc.RowCount>1 then
begin
for i:=RowSelect to ZtSrc.RowCount-2 do
ZtSrc.Rows[i]:=ZtSrc.Rows[i+1];
ZtSrc.RowCount:=ZtSrc.RowCount-1;
end
else
ZtSrc.Rows[0].Clear;
end;
var
RowSelect:integer;
i:integer;
begin
RowSelect:=ZtSrc.Row;
if ZtDst.Cells[0,0]='' then
ZtDst.Rows[0].Text:=ZtSrc.Rows[RowSelect].Text
else
begin
ZtDst.RowCount:=ZtDst.RowCount+1;
ZtDst.Rows[ZtDst.RowCount-1].Text:=ZtSrc.Rows[RowSelect].Text;
end;
if ZtSrc.RowCount>1 then
begin
for i:=RowSelect to ZtSrc.RowCount-2 do
ZtSrc.Rows[i]:=ZtSrc.Rows[i+1];
ZtSrc.RowCount:=ZtSrc.RowCount-1;
end
else
ZtSrc.Rows[0].Clear;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货