procedure TForm1.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
var
i : Integer;
begin
if Msg.CharCode = VK_RETURN then
begin
i := ActiveControl.ComponentIndex + 1;
if (i = ComponentCount) then
i := 0;
TWinControl(Controls[i]).SetFocus;
end;
Handled := True;
end;
代码没有考虑含有Parent的情况,根据自己需要改吧
本文介绍了一个简单的键盘快捷方式处理程序,用于在窗体上切换焦点到下一个控件。当按下回车键时,程序会将焦点移动到当前活动控件之后的下一个控件。
337

被折叠的 条评论
为什么被折叠?



