Form에 StringGrid, Button, Memo를 하나씩 올려놓고 다음처럼 하시면 됩니다.
procedure TForm1.FormCreate(Sender: TObject);
var
i, j : Integer;
begin
StringGrid1.RowCount := 11;
StringGrid1.ColCount := 6;
for i := 1 to 10 do begin
for j := 0 to 5 do begin
StringGrid1.Cells[j, i] := IntToStr(i)+IntToStr(j);
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
i, j : Integer;
begin
for i := StringGrid1.Selection.Top to StringGrid1.Selection.Bottom do begin
for j := StringGrid1.Selection.Left to StringGrid1.Selection.Right do begin
Memo1.Text := Memo1.Text + ',' + (StringGrid1.Cells[j, i]);
end;
Memo1.Text := Memo1.Text + #13#10;
end;
end;
TStringGrid.Selection속성을 참조하세요...
TStringGrid.Selection.Top, TStringGrid.Selection.Bottom = 선택된셀의 Row인덱스 처음부터 끝
TStringGrid.Selection.Left, TStringGrid.Selection.Right = 선택된셀의 Column인덱스 처음부터 끝
^^ 항상 즐코하세요...