1、在窗体的OnKeyPress(or OnKeyDown)中加入
if key=#13 then //如果加在KeyDown中,则为13 or VK_RETURN
begin
//此处可加条件,若有不需用回车代替的控件,如TstringGrid
//if not (ActiveControl is TstringGrid) then
key:=#0;
Perform(WM_NextDlgCtl,0,0);
End;
2、设置窗体的KeyPreview属性为True
1、在窗体的OnKeyPress(or OnKeyDown)中加入
if key=#13 then //如果加在KeyDown中,则为13 or VK_RETURN
begin
//此处可加条件,若有不需用回车代替的控件,如TstringGrid
//if not (ActiveControl is TstringGrid) then
key:=#0;
Perform(WM_NextDlgCtl,0,0);
End;
2、设置窗体的KeyPreview属性为True