Color chooser MFC
I have a dialog box that has a little rectangle in it. When the user clicks this rectangle, a CColorDialog box pops up and queries the user for a color. Once the user picks a color, this CColorDialog closes and this rectangle is to be drawn using that color.
The rectangle itself I have implemented as a CStatic member that is simply a rectangle set to black in the Resource Editor. I can change the color of the box by getting this item, getting it''s DC and painting the rectangle myself. However, when it becomes redrawn, it goes back to it''s original black.
How do I make it so that I can change the color of this rectangle and it will stay changed even when it needs to be redrawn? I tried overriding the OnPaint member of the dialog box class and getting the Client Rect of the rectangle itself and drawing it but the rectangle doesn''t appear in the right place... it appears in the top left of the dialog box itself. Is there a way to offset it to the correct position within the dialog box?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement