从TWinControl继承的才有OnKeyDown,TFlatButton是从TGraphicControl继承的!TNewButton=class(TFlatButton)
    private
      FOnKeyDown: TKeyEvent;
      procedure WMKeyDown(var Message: TWMKeyDown); message WM_KEYDOWN;
    protected
      procedure KeyDown(var Key: Word; Shift: TShiftState); dynamic;
    public
      constructor Create(AOwner: TComponent);override;
    published  
      property OnKeyDown: TKeyEvent read FOnKeyDown write FOnKeyDown;
end;constructor TNewButton.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
end;
procedure TNewButton.KeyDown(var Key: Word; Shift: TShiftState);
begin
  if Assigned(FOnKeyDown) then FOnKeyDown(Self, Key, Shift);
end;function TNewButton.DoKeyDown(var Message: TWMKey): Boolean;
var
  ShiftState: TShiftState;
  Form: TCustomForm;
begin
  Result := True;
  Form := GetParentForm(Self);
  if (Form <> nil) and (Form <> Self) and Form.KeyPreview and
    TWinControl(Form).DoKeyDown(Message) then Exit;
  with Message do
  begin
    ShiftState := KeyDataToShiftState(KeyData);
    if not (csNoStdEvents in ControlStyle) then
    begin
      KeyDown(CharCode, ShiftState);
      if CharCode = 0 then Exit;
    end;
  end;
  Result := False;
end;
procedure TNewButton.WMKeyDown(var Message: TWMKeyDown);
begin
  if not DoKeyDown(Message) then inherited;
end;