Posted on 1997-09-17
I load a bitmap from my users hard drive. I find that my user only has 256 colours available. So I need to realize a palette. So why doesn't:
PalPrev := SelectPalette(Canvas.Handle, MyBitmap.Palette, False);
r := RealizePalette(Canvas.Handle);
//show my picture here (with flashy effect!)
//afterwards, clean up:
SelectPalette(Canvas.Handle, PalPrev, True);
work? (note, Canvas refers to the main form's canvas)
I tried changing the painting to a TPaintBox, but I got the same answer. Please also note that (for the form) I am intercepting the WM_ERASEBACKGROUND message, in order for my special effects to be flicker free. Surely that can't be the problem? Also, I know that MyBitmap has a palette.
I'll give anyone who can solve my problem a B, with an A reserved for those who give me a good explanation of why my above code doesn't work.