Combine example for Visual Basic

This example copies the Lead1 bitmap to Lead2, trims and filters the copied image, and combines the filtered image with the original Lead1 bitmap image. Trimming Lead2 lets you see the difference between filtered and nonfiltered regions.

MousePointer = 11 ' hourglass
Lead2.Bitmap = Lead1.Bitmap

TrimLeft = (Lead2.BitmapWidth * 0.2)
TrimTop = (Lead2.BitmapHeight * 0.2)
TrimWidth = (Lead2.BitmapWidth * 0.6)
TrimHeight = (Lead2.BitmapHeight * 0.6)
Lead2.Trim TrimLeft, TrimTop, TrimWidth, TrimHeight

Lead2.SpatialFilter (FLT_LINESEG_LTOR)

DstLeft = TrimLeft
DstTop = TrimTop
DstWidth = TrimWidth
DstHeight = TrimHeight
SrcLeft = 0
SrcTop = 0
Lead1.Combine DstLeft, DstTop, DstWidth, DstHeight, Lead2.Bitmap, SrcLeft, SrcTop, CB_OP_ADD

Lead1.ForceRepaint
MousePointer = 0 ' default