Solved

256-color CBitmapButton

Posted on 1997-07-22
7
200 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 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

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 112
method notes when mouse over in eclipse 5 90
string initialization in java 11 117
Unix Command -- Challenging  question 7 102
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.

726 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