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
Solved

256-color CBitmapButton

Posted on 1997-07-22
7
198 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
  • 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
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 100 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
haveThree challenge 22 121
twoTwo  challenge 35 107
zeroFront challenge 7 111
EvenOdd challenge 10 125
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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