Solved

Issue drawing radio buttons in MFC

Posted on 2012-04-04
3
377 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 33

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Drive driver 2 104
Get the height value of a parent form 2 178
Visual Studio C# newbie question - How do I separate this code 3 93
Visual Studio Community 2015 updates failed 5 85
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

813 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

13 Experts available now in Live!

Get 1:1 Help Now