ColorResList Example for Access 2.0

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

' Save the current transparent color.
TransparentColor = Me![LEAD1].Object.BitmapTransparentColor

' Avoid repaints while we modify the bitmaps.
Me![LEAD1].Object.AutoRepaint = False

' Change the hue of each bitmap in the list,
' and restore the transparent color as the last color in the palette.
uCount = Me![LEAD1].Object.BitmapListCount
For i = 0 To uCount - 1
   Me![LEAD1].Object.BitmapListIndex = i
   Me![LEAD1].Object.Hue i * 10
   Me![LEAD1].Object.BitmapPalette(255) = TransparentColor
Next i

' Get an optimized palette for the whole list.
Me![LEAD1].Object.ColorResList 8, CRP_OPTIMIZEDPALETTE, CRD_NODITHERING, 0

' Update the palette that is used for playback.
For i = 0 To 255
   Me![LEAD1].Object.AnimationPalette(i) = Me![LEAD1].Object.BitmapPalette(i)
Next i

' Start the animation.
Me![LEAD1].Object.AutoRepaint = True
Me![LEAD1].Object.AnimationEnable = True