Capturing an Area (Builder 3.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 (Builder).

2.

Add a command button and name it as follows:

 

Name

Caption

 

CapArea

Capture Area

3.

Code the CapAreaClick procedure as follows:

 

void __fastcall TForm1::CapAreaClick(TObject *Sender)

{

/*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;

}

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.