Combining Images with Regions (Visual Basic)

Take the following steps to start a project and to add some code that combines two images with a region:

1.

Start Visual Basic.

2.

Add the LEAD Raster View Control to your project.

 

On the Project pull-down menu, use the Components option, and select the LEAD Raster View Control (14.5).

3.

Add the LEAD Raster Object Library and LEAD Raster Variant Object Library to your project.

 

On the Project pull-down menu, use the References option, and select the LEAD Raster Object Library (14.5).

 

On the Project pull-down menu, use the References option, and select the LEAD Raster Variant Object Library (14.5).

4.

Add the LEAD RasterIO Object Library to your project.

 

On the Project pull-down menu, use the References option, and select the LEAD RasterIO Object Library (14.5).

5.

Add the LEAD Raster Process Object Library to your project.

 

On the Project pull-down menu, use the References option, and select the LEAD Raster Process Object Library (14.5).

6.

image\btnlead.gif Select the LEAD RasterView control; then add the control to your main form. Size and position the control as you want it to appear at run time.

7.

image\btnlead.gif Select the LEAD RasterView control; then add the control to your main form. Size and position the control as you want it to appear at run time.

8.

Select the second LEAD control, and pull-down the View menu and select Properties Window.

9.

Make the Visible property is set to FALSE.

10.

Add the following code to the main form's Load procedure. In online help, you can use the Edit pull-down menu to copy the block of code.

Private Sub Form_Load()
   Dim LEADRasIO As New LEADRasterIO
   Dim LEADRasterProc As New LEADRasterProcess

   LEADRasIO.Load LEADRasterView1.Raster, "c:\sample1.cmp", 0, 0, 1
   LEADRasIO.Load LEADRasterView2.Raster, "c:\sample2.cmp", 0, 0, 1

   LEADRasterView1.Raster.SetRgnRect 100, 100, 300, 300, L_RGN_SET
   LEADRasterProc.Combine LEADRasterView1.Raster, 100, 100, 300, 300, LEADRasterView2.Raster, 0, 0, CB_OP_ADD + CB_DST_0

   LEADRasterView1.Raster.FreeRgn
End Sub

11.

Run your program to test it.

12.

Save the project be used as a starting point for other tasks in this tutorial.