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 Control to your project.

For VB4: On the Tools pull-down menu, use the Custom Controls option, and select the LEAD OLE Custom Control (16).

For VB5: On the Project pull-down menu, use the Components option, and select the LEAD Main ActiveX Control (16).

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

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

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

6. Make sure the Visible property is set to FALSE.

7 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.

 

   LEAD1.Load "c:\sample1.cmp", 0, 0, 1
   LEAD2.Load "c:\sample2.cmp", 0, 0, 1

   LEAD1.SetRgnRect 100, 100, 300, 300, L_RGN_SET
   LEAD1.Combine 100, 100, 300, 300, LEAD2.Bitmap, 0, 0, CB_OP_ADD + CB_DST_0

   LEAD1.FreeRgn

8 Run your program to test it.