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: 388
  • Last Modified:

Issue drawing radio buttons in MFC

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();
    theButton->Create(name,WS_CHILD|WS_VISIBLE|BS_AUTORADIOBUTTON,CRect(loc.x,loc.y,loc.x+siz.x,loc.y+siz.y),this,ID);
      return theButton;
    }
radiobutton-problem.jpg
0
LogicalDecisions
Asked:
LogicalDecisions
  • 2
1 Solution
 
sarabandeCommented:
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.

Sara
0
 
LogicalDecisionsAuthor Commented:
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.
0
 
LogicalDecisionsAuthor Commented:
too much work to implement
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

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