Capturing an Area (Delphi 4.0)

Take the following steps to add code that will let you capture a triangular area.

 

1.

Start with the project that you created in Capturing an Active Window (Delphi).

2.

Add a command button and name it as follows:

 

Name

Caption

 

CapArea

Capture Area

3.

Code the CapAreaClick procedure as follows:

 

procedure TForm1.CapAreaClick(Sender: TObject);
begin

{set up the info window}
LEADScr1.CaptureAreaShowInfoWindow := True;
LEADScr1.CaptureAreaInfoTop := 0;
LEADScr1.CaptureAreaInfoLeft := 0;
LEADScr1.CaptureAreaInfoHeight := 300;
LEADScr1.CaptureAreaInfoWidth := 300;

{show area size and cursor information on an opaque background}
LEADScr1.CaptureAreaShowAreaSize := True;
LEADScr1.CaptureAreaShowCursorPosition := True;
LEADScr1.CaptureAreaShowOpaqueText := True;

{set text colors, fill colors, fill pattern, and line style}
LEADScr1.CaptureAreaDrawLineColor := clBlack;
LEADScr1.CaptureAreaTextBackColor := clBlue;
LEADScr1.CaptureAreaTextForeColor := clWhite;
LEADScr1.CaptureAreaFillBackColor := clRed;
LEADScr1.CaptureAreaFillForeColor :=clBlue;
LEADScr1.CaptureAreaFillPattern := bsCross; LEADScr1.CaptureAreaDrawLineStyle := psDash;

{do not include the cursor in the image}
LEADScr1.CaptureAreaIncludeCursor := False;

{do not enable the keyboard}
LEADScr1.CaptureAreaEnableKeyboard := False;

{save a bitmap with a region}
LEADScr1.CaptureAreaBitmapWithRegion := True;

{make the info window sensitive to the position of the cursor}
LEADScr1.CaptureAreaSensitiveInfoWindow := True;

{zoom the image in the info window}
LEADScr1.CaptureAreaZoomFactor := 2; 
{use the cross lines cursor instead of the CaptureAreaDrawCursorIndex}
LEADScr1.CaptureAreaUseCrossLinesCursor := True;
LEADScr1.CaptureAreaShowDrawCursor := True;

{capture a triangular area}
LEADScr1.CaptureArea (CAPTURE_AREA_TRIANGLE);

{assign the Screen Capture Control bitmap to the Main Control bitmap}
LEAD1.Bitmap := LEADScr1.Bitmap;

end;

 

4.

Run your program to test it. Click the Capture Area control button, press F11, and click and drag to select the area to capture.