在onpress 事件中 if key=#13 then stringgrid.col:=stringgrid.col+1;
procedure TForm1.StringGrid1KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then stringgrid1.Perform(WM_KEYDOWN, VK_DOWN,0); end;
procedure TForm1.StringGrid1KeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then with StringGrid1 do if Col < ColCount-1 then {next column!} Col := Col + 1 else if Row < RowCount-1 then begin {next Row!} Row := Row + 1; Col := 1; end else begin {End of Grid! - Go to Top again!} Row := 1; Col := 1; {or you can make it move to another Control} end; end;
if key=#13 then
stringgrid.col:=stringgrid.col+1;
begin
if key=#13 then
stringgrid1.Perform(WM_KEYDOWN, VK_DOWN,0);
end;
begin if Key = #13 then
with StringGrid1 do
if Col < ColCount-1 then {next column!}
Col := Col + 1
else if Row < RowCount-1 then begin {next Row!}
Row := Row + 1;
Col := 1;
end else begin {End of Grid! - Go to Top again!}
Row := 1;
Col := 1;
{or you can make it move to another Control}
end;
end;