procedure TForm1.FormKeyPress(Sender: TObject; var Key:
Char);
begin
if Key = #13 then //如果是一個Enter鍵盤
begin
if not (ActiveControl is TDBGrid) then //如果當前的控件不是TDBGrid
begin
Key := #0;
Perform(WM_NEXTDLGCTL, 0, 0); { move to next control }
end
else if (ActiveControl is TDBGrid) then //在TDBGrid中
begin
with TDBGrid(ActiveControl) do
begin
if selectedindex < (fIEldcount -1) then //如果不是最後一個字段
selectedindex := selectedindex +1
else
selectedindex := 0;
end;
end;
end;
end;