
Bug in hPal property of PictureBox?
Zorro is right: the hpal property of VB4 pictureboxes is essentially
useless AFAIK. It _does_ return the handle of a palette, but it's been
munged with the system palette and you can never be sure what's in there,
and changing it does not have the desired effect.
This'll do the job:
'Pal is a logical palette structure:
'set palette in clipboard, then paste into control
hPal = CreatePalette(Pal)
If OpenClipboard(Pict.Parent.hWnd) Then
RetVal = SetClipboardData(CF_PALETTE, hPal)
RetVal = CloseClipboard()
Pict.Picture = Clipboard.GetData(CF_PALETTE)
End If
Jim Deutch
Quote:
> Hi,
> I need to change the palette of a bitmap, either in a PictureBox
> control or a Picture object. However, the hPal property seems to be
> returning the *number* of colours, not a handel to the palette.
> Does anyone have any ideas of an alternate way I could go about this?
> I am using VB4 16 and 32 bit under Win95.
> Many thanks,
> James.
> PS Yes I have tried the knowledge base and the web pages!