All you need is a PictureBox and
a picture with many different colors.
First you'll have to select a palette
(with the SelectPalette-function) and
then you'll have to set that palette as
the global Windows-palette.
This example is best tested in 8-bit
modus (256-colors).
Private
Declare Function RealizePalette Lib "gdi32" (ByVal hdc As
Long) As
Long
Private Declare
Function
SelectPalette Lib "gdi32" (ByVal hdc As
Long, ByVal hPalette As
Long, ByVal bForceBackground As
Long) As
Long
Private Sub Form_Activate()
SelectPalette Picture1.hdc,
Picture1.Picture.hPal, False
RealizePalette Picture1.hdc
End Sub
To create
your own palette, use the
CreatePalette-function.
|