procedure TForm1.FormPress(...) begin if key=chr(VK_F4) and (ssAlt in shit) then exit; end;
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if (Key=VK_F4) and (Shift=[ssAlt]) then begin key:= 0; shift:=[]; end; end;
写在closequery事件中,只要关闭close就触发该事件。 procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin canclose:=false; if application.messagebox ('是否要?','退',MB_YESNO+mb_iconinformation)=idyes then canclose:=true; end
begin
if key=chr(VK_F4) and (ssAlt in shit) then
exit;
end;
Shift: TShiftState);
begin
if (Key=VK_F4) and (Shift=[ssAlt]) then
begin
key:= 0;
shift:=[];
end;
end;
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
canclose:=false;
if application.messagebox
('是否要?','退',MB_YESNO+mb_iconinformation)=idyes then
canclose:=true;
end
把FORM的KEYPREVIEW打开