DIB example for Visual Basic

This example copies the Lead1 bitmap to the clipboard as a DIB. It pastes the DIB into Lead2 and reverses the image. It then gets a DIB from Lead2, sets the same DIB to Lead1, and repaints.

MousePointer = 11 ' hourglass
MyFlags = COPY_EMPTY + COPY_DIB + COPY_PALETTE
 Lead1.Copy MyFlags

If Lead2.Paste(PASTE_ISREADY) = 0 Then
    MsgBox ("Invalid data on the clipboard")
Else
    Lead2.Paste 0
End If

Lead2.Reverse
MyDib = Lead2.GetDIB
Lead1.SetDIB MyDib
Lead1.ForceRepaint
MousePointer = 0 ' default