Trim example for Visual Basic

This example crops one-tenth from the bitmap and repaints the image.

' Declare local variables
Dim NewLeft, NewTop, NewWidth, NewHeight, ViewWidth, ViewHeight

NewLeft = Lead1.BitmapWidth * .1
NewTop = Lead1.BitmapHeight * .1
NewWidth = Lead1.BitmapWidth * .8
NewHeight = Lead1.BitmapHeight * .8
Lead1.Trim NewLeft, NewTop, NewWidth, NewHeight

' Set variables for the position and size of the display rectangle.
ViewWidth = Lead1.ScaleWidth
ViewHeight = Lead1.ScaleHeight

' Set the image display size to match the LEAD control
Lead1.SetDstRect 0, 0, ViewWidth, ViewHeight
Lead1.SetDstClipRect 0, 0, ViewWidth, ViewHeight
Lead1.ForceRepaint