RefBitmap example for Visual Basic

'This example demonstrates the RefBitmap property

Private Sub Command79_Click()
Dim MyRaster As LEADRaster
Set MyRaster = CreateObject("leadraster.leadraster. ")
Dim MyRasterIO As LEADRasterIO
Set MyRasterIO = CreateObject("LEADRasterIO.LEADRasterIO. ")

'Load an image into MyRaster object
MyRasterIO.Load MyRaster, "d:\work\images\rgbw.bmp", 0, 0, 1
MsgBox "MyRaster.Bitmap should be non-zero: " & MyRaster.Bitmap

'Have the LEADRasterView1 control "steal" the MyRaster bitmap
LEADRasterView1.raster.RefBitmap = True
LEADRasterView1.raster.Bitmap = MyRaster.Bitmap

'The MyRaster Bitmap has been invalidated
MsgBox "MyRaster.Bitmap should be zero: " & MyRaster.Bitmap
End Sub