程序的一部分,是对多个单元赋值,你自己改改吧。
procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
var m,n,m1,m2,n1,n2:integer;
disp:string;
begin
m1:=stringgrid1.selection.left;
n1:=stringgrid1.Selection.Top;
m2:=stringgrid1.Selection.Right;
n2:=stringgrid1.Selection.Bottom;
if (m1<>m2) or (n1<>n2) then
begin
for m:=m1 to m2 do
for n:=n1 to n2 do
stringgrid1.Cells[m,n]:=dispcel;
exit;
end;
...