将窗体的keypreview置为trueprocedure Tform1.FormKeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin Key := #0; Keybd_event(VK_TAB, 0, 0, 0); end; end;
//设置窗体的KeyPriview属性为True, 并写入如下代码: procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin SendMessage(Handle, WM_NEXTDLGCTL, 0, 0); Key := #0; end; end;
begin
if Key = #13 then
begin
Key := #0;
Keybd_event(VK_TAB, 0, 0, 0);
end;
end;
begin
if Key = #13 then
begin
SendMessage(Handle, WM_NEXTDLGCTL, 0, 0);
Key := #0;
end;
end;