以下代码经本人在Delphi XE2下编写并通过。
procedure TForm5.img1Click(Sender: TObject); var i : Integer; begin try if img1.Picture.Graphic = nil then begin if MessageBox(Handle, PChar(' 是否需要截图? 点击 ''''是(Y)'''' 后请等待1秒进入截图! '), PChar('截图工具'), MB_ICONINFORMATION or MB_YESNO or MB_DEFBUTTON1) = IDNO then Exit; Hide; ICSystem.Form1.Hide; Sleep(700); i := WinExecAndWait32('PrintScreen.exe',True); ICSystem.Form1.Show; Show; if i = 0 then img1.Picture.LoadFromClipboardFormat(CF_BITMAP,ClipBoard.GetAsHandle(CF_BITMAP),0); end else begin with TForm6.Create(Application) do begin imgSimg.Picture.Graphic := img1.Picture.Graphic; ShowModal; if ModalResult = mrCancel then begin Free; end; end; end; except end; end;