Solved

256-color CBitmapButton

Posted on 1997-07-22
7
191 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
Comment Utility
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
Comment Utility
All the pictures have been made with the standard 256-palette. BitmapButton just doesn't show all of them.

0
 

Author Comment

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

0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 4

Expert Comment

by:AVaulin
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now