当前位置:编程学习 > Delphi >>

Delphi按下回车键使各控件依次获得焦点

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的情况,根据自己需要改吧
补充:软件开发 , Delphi ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,