Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 1997-08-13
3
366 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
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 85
Get filename and folder into excel 7 79
notReplace  challenge 53 141
unix example issues 18 98
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

856 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