procedure TWinControl.CNKeyDown(var Message: TWMKeyDown); var Mask: Integer; begin with Message do begin Result := 1; if IsMenuKey(Message) then Exit; if not (csDesigning in ComponentState) then begin if Perform(CM_CHILDKEY, CharCode, Integer(Self)) <> 0 then Exit; Mask := 0; case CharCode of VK_TAB: Mask := DLGC_WANTTAB; VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN: Mask := DLGC_WANTARROWS; VK_RETURN, VK_EXECUTE, VK_ESCAPE, VK_CANCEL: Mask := DLGC_WANTALLKEYS; end; if (Mask <> 0) and (Perform(CM_WANTSPECIALKEY, CharCode, 0) = 0) and (Perform(WM_GETDLGCODE, 0, 0) and Mask = 0) and (GetParentForm(Self).Perform(CM_DIALOGKEY, CharCode, KeyData) <> 0) then Exit; end; Result := 0; end; end; 消息,应该是底层问题。
var
Mask: Integer;
begin
with Message do
begin
Result := 1;
if IsMenuKey(Message) then Exit;
if not (csDesigning in ComponentState) then
begin
if Perform(CM_CHILDKEY, CharCode, Integer(Self)) <> 0 then Exit;
Mask := 0;
case CharCode of
VK_TAB:
Mask := DLGC_WANTTAB;
VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN:
Mask := DLGC_WANTARROWS;
VK_RETURN, VK_EXECUTE, VK_ESCAPE, VK_CANCEL:
Mask := DLGC_WANTALLKEYS;
end;
if (Mask <> 0) and
(Perform(CM_WANTSPECIALKEY, CharCode, 0) = 0) and
(Perform(WM_GETDLGCODE, 0, 0) and Mask = 0) and
(GetParentForm(Self).Perform(CM_DIALOGKEY,
CharCode, KeyData) <> 0) then Exit;
end;
Result := 0;
end;
end;
消息,应该是底层问题。