Capturing a Selected Object (Visual Basic 5 and later)
Take the following steps to add code that will let you capture a selected object.
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 |
|
CapObj |
Capture Object |
3. |
Code the CapObj_Click procedure as follows: |
Private Sub CapObj_Click()
'display the capture selected object dialog
LEADRasterScr1.CaptureObjectOptionDlg hWnd
'capture the selected object
LEADRasterScr1.CaptureSelectedObject
'assign the screen control bitmap to the Main control bitmap
LEADRasterView1.Raster.Bitmap = LEADRasterScr1.Bitmap
'reset the object options
LEADRasterScr1.ResetObjectOptions
End Sub
4. |
Run your program to test it. Click the Capture Select button. Set the options and click OK. Select the window containing the object you want to capture. Press F11, and click the left mouse button to make the selection. |