Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 255
  • Last Modified:

How can I change the brush color again?

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
heli1
Asked:
heli1
1 Solution
 
AlexFMCommented:
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
 
nandenCommented:
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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now