procedure TForm1.Button1Click(Sender: TObject); var myRect: TGridRect; var i,j: integer; S : String; begin MyRect := StringGrid.Selection; // myRect.Left : 起始列; // myRect.Top : 起始行; // myRect.Right : 终止列; // myRect.Bottom : 终止行; for i := rect.left to rect.right do for j := rect.top to myrect.bottom do begin S := Cells[i,j]; //想干什么就干 end; end;
var
myRect: TGridRect;
var i,j: integer;
S : String;
begin
MyRect := StringGrid.Selection;
// myRect.Left : 起始列;
// myRect.Top : 起始行;
// myRect.Right : 终止列;
// myRect.Bottom : 终止行;
for i := rect.left to rect.right do
for j := rect.top to myrect.bottom do
begin
S := Cells[i,j];
//想干什么就干
end;
end;