unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TForm1 = class(TForm) Panel1: TPanel; Label1: TLabel; Edit1: TEdit; Label2: TLabel; Edit2: TEdit; Label3: TLabel; Edit3: TEdit; Label4: TLabel; Edit4: TEdit; Label5: TLabel; Edit5: TEdit; Label6: TLabel; Edit6: TEdit; Button1: TButton; Button2: TButton; procedure Edit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = vk_Return then FindNextControl(ActiveControl,True,False,False).SetFocus; end; procedure TForm1.Button2Click(Sender: TObject); begin Close; end; end.
原文:https://www.cnblogs.com/jijm123/p/10826982.html