Solved

CreateSolidBrush() doesn't make a "solid" brush

Posted on 1997-08-13
3
322 Views
Last Modified: 2013-11-19
When I used CreateSolidBrush() to create a brush, and then used FillRect to fill an area with that brush, I was expecting that every pixel of the entire area would be the same color.   However, the brush doesn't appear to truly be solid.  I end up with what appears to be a dithered pattern.   Is this the way CreateSolidBrush works?   Or am I doing something wrong?   When I truly want to fill an area with a solid color, I am currently, creating a pen and drawing over the entire area with a loop of LineTo calls.
0
Comment
Question by:JohnWeidner
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
davmarc earned 100 total points
Comment Utility
CreateSolidBrush() does not guarantee that it creates a really solid brush: it trues to do it, but the result might be dithered.
Checking if the result of GetNearestColor() and the COLORREF you pass to it are equal will reveal you whether or not a solid brush can be created.

Use GetNearestColor() as parameter for CreateSolidBrush() to be sure that it creates a solid brush.

Davide Marcato.
0
 

Author Comment

by:JohnWeidner
Comment Utility
Thanks!
0
 
LVL 4

Expert Comment

by:davmarc
Comment Utility
Glad to help!

Davide Marcato.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

6 Experts available now in Live!

Get 1:1 Help Now