如何用<Enter>键代替<Tab>键实现光标焦点转移?

1、在主窗体的private中定义过程:

procedure doenterastab(var Msg:TMsg;var Handled:Boolean);

begin
    if Msg.message=WM_KEYDOWN then
    begin
       if Msg.wParam=VK_RETURN  then
          keybd_event(VK_TAB,0,0,0);
    end; 
end; 

2、在主窗体的oncreate事件中加入:

Application.OnMessage:=doenterastab;

原文地址:https://www.cnblogs.com/wxb-km/p/3444377.html