Gradient in 16 color system

Posted on 2005-04-17
Last Modified: 2013-11-20
I’m trying to add Gradient effect to my control, and after I finished I found that my gradient lost its colors and get a bad look when using 256 or 16 color mode system.
So I implement a palette from CPalette class and fill it with my gradient colors.
The problem has been fixed when using 256 color system, but it is still appear when using 16 color system.
Any one can help me to fix it when using 16 color mode?

Question by:ASD-JO
    LVL 37

    Accepted Solution

    Hi ASD-JO,
        It is an unsolvable problem :(
        In 16 colour mode, you cannot get the illusion of changing colours as there are less colours and also they are far more distinguishable ones.


    Author Comment


    I want to add the following points:

    1- In the 256 color system when select the Palette object using CDC::SelectPalette(&m_Pal, FALSE), the problem fixed as I wrote the first time, but I notice that the windows desktop lost parts of its colors in the time while my control is running. ( m_Pal is the CPalette object )

    I want to ask why this happened and how can i solve this problem while keeping the quality of my gradient without effect the windows colors.

    2- About the 16 color system, I don’t want to get the same quality as I get in 256 color system after using the CPalette object, but I want at least the quality that u can get when drawing using brush and region(I used this way at first but it is very slaw).

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    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: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
    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.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 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

    9 Experts available now in Live!

    Get 1:1 Help Now