ColorResList Example for Visual Basic

Note: Also works with Access 95 and 97.

This example changes the hue of bitmaps in a list, then plays the list as an animation. When changing the hue, it preserves the transparent color.

Dim i As Integer  ' Loop counter
Dim uCount As Integer ' Number of bitmaps in the list
Dim TransparentColor As Long ' Color used for transparency
Dim RasterProc As New LEADRasterProcess
' Save the current transparent color.
TransparentColor = LEADRasterView1.Raster.BitmapTransparentColor
' Avoid repaints while we modify the bitmaps.
LEADRasterView1.AutoRepaint = False
' Change the hue of each bitmap in the list,
' and restore the transparent color as the last color in the palette.
uCount = LEADRasterView1.Raster.BitmapListCount
For i = 0 To uCount - 1
   LEADRasterView1.Raster.BitmapListIndex = i
   RasterProc.Hue LEADRasterView1.Raster, i * 10
   LEADRasterView1.Raster.BitmapPalette(255) = TransparentColor
Next I
' Get an optimized palette for the whole list.
RasterProc.ColorResList LEADRasterView1.Raster, 8, CRP_OPTIMIZEDPALETTE, CRD_NODITHERING, 0
' Update the palette that is used for playback.
For i = 0 To 255
   LEADRasterView1.AnimationPalette(i) = LEADRasterView1.Raster.BitmapPalette(i)
Next I
' Start the animation.
LEADRasterView1.AutoRepaint = True
LEADRasterView1.AnimationEnable = True