Capturing an Area (Visual Basic 5 and later)
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. |
|
2. |
Add a command button and name it as follows: |
|
|
Name |
Caption |
|
CapArea |
Capture Area |
3. |
Code the CapArea_Click procedure as follows: |
Private Sub CapArea_Click()
'set the units of measure
LEADRasterScr1.ScaleMode = 3
' set up the info window
LEADRasterScr1.CaptureAreaShowInfoWindow = True
LEADRasterScr1.CaptureAreaInfoTop = 0
LEADRasterScr1.CaptureAreaInfoLeft = 0
LEADRasterScr1.CaptureAreaInfoHeight = 300
LEADRasterScr1.CaptureAreaInfoWidth = 300
'show area size and cursor information on an opaque background
LEADRasterScr1.CaptureAreaShowAreaSize = True
LEADRasterScr1.CaptureAreaShowCursorPosition = True
LEADRasterScr1.CaptureAreaShowOpaqueText = True
'set text colors, fill colors, fill pattern, and line style
LEADRasterScr1.CaptureAreaDrawLineColor= vbBlack
LEADRasterScr1.CaptureAreaTextBackColor= vbBlue
LEADRasterScr1.CaptureAreaTextForeColor = vbWhite
LEADRasterScr1.CaptureAreaFillBackColor = vbRed
LEADRasterScr1.CaptureAreaFillForeColor = vbBlue
LEADRasterScr1.CaptureAreaFillPattern= CAPTURE_AREA_PATTERN_CROSS
LEADRasterScr1.CaptureAreaDrawLineStyle= CAPTURE_AREA_LINE_DASH
'do not include the cursor in the image
LEADRasterScr1. CaptureAreaIncludeCursor = False
'do not enable the keyboard
LEADRasterScr1.CaptureAreaEnableKeyboard = False
'save a bitmap with a region
LEADRasterScr1.CaptureAreaBitmapWithRegion = True
'make the info window sensitive to the position of the cursor
LEADRasterScr1.CaptureAreaSensitiveInfoWindow = True
'zoom the image in the info window
LEADRasterScr1.CaptureAreaZoomFactor = CAPTURE_AREA_ZOOM_BY2X
'use the cross lines cursor instead of the CaptureAreaDrawCursorIndex
LEADRasterScr1.CaptureAreaUseCrossLinesCursor = True
LEADRasterScr1.CaptureAreaShowDrawCursor = True
'capture a triangular area
LEADRasterScr1.CaptureArea SCR_CAP_AREA_TRIANGLE
'assign the Screen Capture Control bitmap to the Main Control bitmap
LEADRasterView1.Raster.Bitmap = LEADRasterScr1.Bitmap
End Sub
4. |
Run your program to test it. Click the Capture Area command button, press F11, and click and drag to select a region. |