Issue drawing radio buttons in MFC

LogicalDecisions used Ask the Experts™
I'm having trouble drawing a pair of radio buttons on a MFC child window in a relatively large program.  The buttons are getting drawn incorrectly with black fill partially surrounding the buttons instead of the white fill that I assume is the default, as shown in the attached screen capture.  Here is a small code snippet of how the buttons get created, but I'm hoping someone will recognize what is going on without my providing a lot of details.  I'm happy to provide more if someone can provide direction on where to look for the error:

CButton* MyCScrollView::MakeButton(CButton *theButton,CPoint loc,CPoint siz,int ID,wchar_t *name){
        theButton = new CButton();
      return theButton;
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

you could create a test dialog form using the resource editor and add two kind of radio buttons: one where the buttons are without label and another with labels.

open the rc file of that dialog with text editor and check the parameters. they would be rather similar to that you passed to the Create call but probably different somewhere (probably in the rectangle sizes) and i would guess that at least the variant without label also would work in your program and it shouldn't be a problem to draw the text yourself or use an extra static control. of course you could calculate the rectangle dynamically but the coordinates passed should be similar than those in the rc file.

I never did figure out what was going on.  I ended up creating a subclass of CButton and doing an owner draw.  It fixed the problem, but was a lot of work for not much reward.


too much work to implement

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial