Solved

Issue drawing radio buttons in MFC

Posted on 2012-04-04
3
371 Views
Last Modified: 2012-04-14
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
Comment
Question by:LogicalDecisions
  • 2
3 Comments
 
LVL 32

Expert Comment

by:sarabande
ID: 37810310
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
 

Accepted Solution

by:
LogicalDecisions earned 0 total points
ID: 37824924
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
 

Author Closing Comment

by:LogicalDecisions
ID: 37845946
too much work to implement
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now