(6) TMAINFORM (graphic) Action event 1) Full screen grab [Capture Desktop] Action event Procedure TMAINFORM.CPTDESKTOPEXECUTE (Sender: Tobject); Begin INC (Capturenum, 1); Application.minimize; // Somatostat DELAY (500); // Minimizes the post-delay, in order to grab itself in the figure in the figure, FileName: = 'Capture' INTOSTOSTR (Capturenum) '. Bmp'; filename: = defaultdirectory filename; CreateMdichild FileName, true); StatusBar.SimpleText: = FileName; with ActiveMDIChild as TMDIChild do begin Image1.Picture.Bitmap: = CaptureScreen; // Grab HorzScrollBar.Range: = Image1.Picture.Width; VertScrollBar.Range: = Image1.Picture . Height; End; Child.Image1.hint: = 'Height:' INTOSTR (child.image1.picture.height) 'Pixels' ' Width: ' INTOSTR (Child.Image1.Picture.Width) ' Pixels Application.Restore; End;
2) Regional graphic grabbing area picture, that is, to use a new Form1, see "Delphi image intercept programming example (6)". Add Capture1 in the USES of Main Unit IMPLEMENTATION. Adding private process in CaptureArea Main unit: procedure TMainForm.CaptureArea; begin with TForm1.Create (Application) do try if ShowModal = mrOK then with fRect do begin if (Right> Left) and (Bottom> Top) then begin Delay (400) ; ABitmap: = TBitmap.Create; ABitmap.Assign (CaptureScreenRect (fRect)); Child.Image1.Picture.Bitmap: = ABitmap; Child.ClientWidth: = Child.Image1.Picture.Width; Child.ClientHeight: = Child.Image1 .Picture.Height; Child.HorzScrollBar.Range: = Child.Image1.Picture.Width; Child.VertScrollBar.Range: = Child.Image1.Picture.Height; ABitmap.Free; end else begin MessageDlg ( 'error selected picture area, Please re-select! ', Mtinformation, [mbok], 0); child.close; form1.free; exit; end; end; fin or free; end; end; [Capture Area] area graphic Action event Procedure TMAINFORM.CPTAREAEXECUTE (Sender: TOBJECT); Begin Inc (Capturenum, 1); Application.minimize; DELAY (500); filename: = 'Capture' INTOSTR (CaptureNum) '. BMP'; filename: = Defauu LTDIRECTORY FILENAME; {Create MDI Child Window} Createmdichild (filename, true); status bar.simpletext: = filename;
{Capture Area of screen} CaptureArea; Child.Image1.Hint: = 'Height:' intToStr (child.Image1.Picture.Height) 'pixels' 'Width:' intToStr (child.Image1.Picture.Width) 'Pixels'; Application.Restore; End;