?
Solved

How can I change the brush color again?

Posted on 2003-02-25
2
Medium Priority
?
251 Views
Last Modified: 2013-11-20
Hi

the part

CBrush brush (RGB (255, 0, 0));
CBrush* pOldBrush = dc.SelectObject (&brush);

works very fine

but how can I change the color?


Many thanks in advance!!
0
Comment
Question by:heli1
[X]
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
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 200 total points
ID: 8015273
To change color of existing CBrush:

brush.DeleteObject();
brush.CreateSolidBrush(RGB(n1, n2, n3));

After this brush should be selected again in device context.
0
 

Expert Comment

by:nanden
ID: 8015817
use brush.DeleteObject() to delete the old brush, recreate the same brush specifying the new values and select it back again as you have done above into the dc.
HTH<
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

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