敬业的IT人 >> 编程开发 >> Delphi >> TDBGrid中用Enter仿真Tab键盘

TDBGrid中用Enter仿真Tab键盘

敬业的IT人 互联网 佚名 2008-1-4 15:44:05
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;
粤ICP备06119539号
Copyright CiscoSky.Org,Some Rights Reserved.
Email:me1228#tom.com