?
Solved

256-color CBitmapButton

Posted on 1997-07-22
7
Medium Priority
?
203 Views
Last Modified: 2013-11-20
How I can use more than 20-color bitmapbutton in 8bit-mode? In better than 8bit everything works fine. MFC seems to reduce colours when I start application.
0
Comment
Question by:srantala
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 4

Expert Comment

by:AVaulin
ID: 1302734
MFC don't reduce colours. It may be Windows does. To remove any problems convert your image to standard 256 palette.
0
 

Author Comment

by:srantala
ID: 1302735
All the pictures have been made with the standard 256-palette. BitmapButton just doesn't show all of them.

0
 

Author Comment

by:srantala
ID: 1302736
All the pictures have been make with the standard 256-colour-palette. BitmapButton just doesn't show all of them.

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:AVaulin
ID: 1302737
Do you use bitmaps with compression? If yes try to save bitamps without compression.
0
 
LVL 23

Accepted Solution

by:
chensu earned 400 total points
ID: 1302738
CBitmapButton does not support 256 colors because it uses ::LoadBitmap() to load the bitmaps, which converts a DIB to a DDB without the palette. So, you have to write your own 256 colors version CBitmapButton. You can refer to MFC source code about CBitmapButton to write your own class. You have to load the 256 colors bitmap as a DIB and whenever the frame window receives WM_QUERYNEWPALETTE and WM_PALETTECHANGED, you should direct them to your button so that it processes the messages.

By the way, there is no standard 256 colors palette in fact.
0
 
LVL 4

Expert Comment

by:AVaulin
ID: 1302739
To chensu:
  Why do you think that there is no standard 256 colors palette? You can choose 16 colors palette from 64 available colors and you can choose 256 colors palette from (don't remember how much) available colors too.
0
 
LVL 23

Expert Comment

by:chensu
ID: 1302740
To AVaulin:
Windows reserves standard 20 colors for system use (window titles, menus, ...) in a palette. The other colors are arbitrary. If an application has its own 256 colors palette, it must process WM_QUERYNEWPALETTE and WM_PALETTECHANGED messages.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month9 days, 20 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question