Solved

256-color CBitmapButton

Posted on 1997-07-22
7
197 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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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 …
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

810 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