Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 1997-08-13
3
Medium Priority
?
425 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 400 total points
ID: 1303696
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
ID: 1303697
Thanks!
0
 
LVL 4

Expert Comment

by:davmarc
ID: 1303698
Glad to help!

Davide Marcato.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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 …
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.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

916 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