Image component only supports 15 colors??? 
Author Message
 Image component only supports 15 colors???

I am having a problem with the VB Image component.  I am loading a
bitmap file into the component using LoadPicture.  The bitmap has a
custom palette of 16 colors.  With my video driver set to 65K colors,
the Image component only displays 15 of the 16 colors; the 16th color
is mapped to one of the other 15 colors.  With the video driver set to
256 colors, the Image component maps the 16 colors to just 4 colors.
I've read the VB documentation and tried several solutions, including
setting the ZOrder to 0 and setting the PaletteMode to Custom and
setting the Palette property of the form to the same bitmap file, with
no success.

Can anyone explain what I'm doing wrong?

My Environment: NT Workstation 4.0 (SP3), VB Enterprise Edition 5.0
(SP3).
32MB RAM.

BTW, the actual component I need to find a solution for is Sylvan
Maps, but the VB Image component behaves identically to Sylvan.

Thanks.

Remove "--" from my address to send me e-mail.



Fri, 07 Jul 2000 03:00:00 GMT  
 Image component only supports 15 colors???

Try putting the palette in a picturebox which is at the top of the ZOrder
(Format\Order\Bring to Front) and use vbPaletteModeUseZOrder instead of
custom.  There seem to be some bugs with the custom palette mode (though I
don't know if this is one of them: I've never seen the behavior you
describe).

Could the problem be video-driver related?  Try changing over to a standard
VGA or SVGA driver and see if that helps.

AFA your later message...yow!  Nobody else needs to do that: LoadPicture()
to an image control works fine for me.  Got all 16 colors.

Jim Deutch
MS Dev MVP



Quote:
> I am having a problem with the VB Image component.  I am loading a
> bitmap file into the component using LoadPicture.  The bitmap has a
> custom palette of 16 colors.  With my video driver set to 65K colors,
> the Image component only displays 15 of the 16 colors; the 16th color
> is mapped to one of the other 15 colors.  With the video driver set to
> 256 colors, the Image component maps the 16 colors to just 4 colors.
> I've read the VB documentation and tried several solutions, including
> setting the ZOrder to 0 and setting the PaletteMode to Custom and
> setting the Palette property of the form to the same bitmap file, with
> no success.

> Can anyone explain what I'm doing wrong?

> My Environment: NT Workstation 4.0 (SP3), VB Enterprise Edition 5.0
> (SP3).
> 32MB RAM.

> BTW, the actual component I need to find a solution for is Sylvan
> Maps, but the VB Image component behaves identically to Sylvan.

> Thanks.

> Remove "--" from my address to send me e-mail.



Sat, 08 Jul 2000 03:00:00 GMT  
 Image component only supports 15 colors???

On Tue, 20 Jan 1998 08:44:38 -0800, "Jim Deutch"

Quote:

>Try putting the palette in a picturebox which is at the top of the ZOrder
>(Format\Order\Bring to Front) and use vbPaletteModeUseZOrder instead of
>custom.  There seem to be some bugs with the custom palette mode (though I
>don't know if this is one of them: I've never seen the behavior you
>describe).

Tried that; didn't make any difference.  Actually, what I did was at
runtime to set the Image control's ZOrder to 0 and set the PaletteMode
of the form to UseZOrder.  Shouldn't that have taken care of it?  It
didn't make any difference for me though.

Quote:

>Could the problem be video-driver related?  Try changing over to a standard
>VGA or SVGA driver and see if that helps.

Another programmer has encountered the problem using VB4 on a
completely different machine, but I don't know the details for that
machine.   I'll do as you suggest and see if I can get more data
points.

Quote:

>AFA your later message...yow!  Nobody else needs to do that: LoadPicture()
>to an image control works fine for me.  Got all 16 colors.

The thing is that it depends upon the colors you have in the bitmap
and the colors you're using elsewhere on the form (or screen??).  So,
you may not encounter the problem.  In my app, I'm not making heavy
use of colors elsewhere on the form, and my video driver is set to 16k
colors.  The bitmap is a topographic overlay with 16 "washed-out"
shades of green, yellow, and brown, so they are not standard Windows
colors or fully saturated colors.  Even if I assume I'm limited to the
256 VB halftone palette, I shouldn't be having a problem???  But I
assure you it is not my imagination!  When I load the same bitmap file
into Paintbrush, it looks right.  When I load the bitmap using my
routine (other message; uses SetDIBits), it also looks right.  Load it
using LoadPicture into an Image control or a PictureBox control, and
at least one of my colors gets "mapped" to something else.

If you like, I can send you a sample bitmap file.  It's about 56K.
(Remove -- from my e-mail address to reply).

Quote:

>Jim Deutch
>MS Dev MVP



>> I am having a problem with the VB Image component.  I am loading a
>> bitmap file into the component using LoadPicture.  The bitmap has a
>> custom palette of 16 colors.  With my video driver set to 65K colors,
>> the Image component only displays 15 of the 16 colors; the 16th color
>> is mapped to one of the other 15 colors.  With the video driver set to
>> 256 colors, the Image component maps the 16 colors to just 4 colors.
>> I've read the VB documentation and tried several solutions, including
>> setting the ZOrder to 0 and setting the PaletteMode to Custom and
>> setting the Palette property of the form to the same bitmap file, with
>> no success.

>> Can anyone explain what I'm doing wrong?

>> My Environment: NT Workstation 4.0 (SP3), VB Enterprise Edition 5.0
>> (SP3).
>> 32MB RAM.

>> BTW, the actual component I need to find a solution for is Sylvan
>> Maps, but the VB Image component behaves identically to Sylvan.

>> Thanks.

>> Remove "--" from my address to send me e-mail.

Remove "--" from my address to send me e-mail.


Sat, 08 Jul 2000 03:00:00 GMT  
 Image component only supports 15 colors???


Quote:
>>Try putting the palette in a picturebox which is at the top of the ZOrder
>>and use vbPaletteModeUseZOrder instead of custom.
>Tried that; didn't make any difference.  Actually, what I did was at
>runtime to set the Image control's ZOrder to 0 and set the PaletteMode
>of the form to UseZOrder.  Shouldn't that have taken care of it?

That won't do. Images are always BEHIND any child windows (like picture
boxes).

HTH,
Bart.



Sun, 09 Jul 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Image or Picture Box with True Color Support

2. Fading picture/image colors from black to color

3. Adding 15 minutes

4. The Access Web-Updates (Feb 15, 1999)

5. Programmaticaly sending mail after only 15 minutes

6. Gung ho newbie - stuck at # 3 on the MVP - VBA basics in 15 minutes

7. Will January 15 be the final .NET-Day ?

8. How to schedule a service to poll every 15 minutes

9. need my users logoff automatically after 15 min

10. It's here - Issue 15 of the Basix Fanzine

 

 
Powered by phpBB® Forum Software