The following code aborts a print job if the user presses Esc. Note that you should set KeyPreview to True to ensure that the OnKeyDown event handler of Form1 is called.procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if (Key=VK_ESCAPE) and Printer.Printing then
begin
Printer.Abort;
MessageDlg('Printing aborted', mtInformation, [mbOK],0);
end;
end;Delphi的帮助例子。
begin
if (Key=VK_ESCAPE) and Printer.Printing then
begin
Printer.Abort;
MessageDlg('Printing aborted', mtInformation, [mbOK],0);
end;
end;Delphi的帮助例子。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货