Solved

Issue drawing radio buttons in MFC

Posted on 2012-04-04
3
382 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 34

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

696 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