Bug in hPal property of PictureBox? 
Author Message
 Bug in hPal property of PictureBox?

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!



Sat, 18 Sep 1999 03:00:00 GMT  
 Bug in hPal property of PictureBox?

There is only one way around the VB palette manager, and you must use the
Clipboard to load the picture with the right palette.  I cannot give you
the specifics, but VBPJ magazine had the code 2 or 3 months ago.
Good Luck
Zorro



Sun, 19 Sep 1999 03:00:00 GMT  
 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!



Sun, 19 Sep 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VB5 Palettes, how to access a PictureBox hPal?

2. .hpal and .Palette bugs in VB5

3. hPal property in Picture control (16 bit VB4)

4. hPal Picture property in VB4/32 vs VB4/16

5. VB6: Property Sheets Bug?, Custom Controls and properties

6. Bug with PictureBox

7. picturebox or image control bug, HELP

8. Bug: drawing/resizing a PictureBox eat up GDI Resources on Win95

9. Viewport, BitBlt and PictureBox.Bug ??

10. Is this a bug with picturebox control?

11. Is there a eVB PictureBox.Drawmode bug?

12. HPAL

 

 
Powered by phpBB® Forum Software