Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Color chooser MFC

This topic is 5798 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post

Link to post
Share on other sites
nevermind... got it
I changed it to a frame instead of rectangle and made sure the notify property was checked.

Then I get the client coords of it... converted them to screen coords and then using the dialog box, converted the screen coords to client coords.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!