Using Palette Indexes As Color Values

Methods and properties that take a COLORREF data type can also reference a particular index in the current bitmap's palette. This can be useful in cases where a color is used for transparency and the palette may contain the same color in more than one palette position.

When specifying a palette index as a color value, use the following formula:

$1000000 OR index

When evaluating a value to see if it is a palette index, you can use the following logic:

if (value AND $1000000)<>0 then
index = value AND $FFFFFF