Enter键使用作Tab键
首先,在主窗体中声明以下private过程:
procedure TMainForm.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; //if
end;
在主窗体的OnCreate事件中加入:
Application.OnMessage := DoEnterAsTab;
procedure TMainForm.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; //if
end;
在主窗体的OnCreate事件中加入:
Application.OnMessage := DoEnterAsTab;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/archive/2008/04/01/2941049.html