Solved

Owner Draw radio button

Posted on 1997-09-11
1
966 Views
Last Modified: 2013-11-20
I want (need) to be able to create radio buttons that are owner-drawn (like a CBitmapButton) but still act like radio buttons.

I tried setting BS_OWNERDRAW in my .RC file and writing a class similar to CBitmapButton but with a DrawItem that tests GetCheck() value and draws the appropriate bitmap (down for checked, up for unchecked, etc.)

But this did not work - BS_OWNERDRAW is 0x0b and BS_AUTORADIOBUTTON is 0x09 (1011 and 1001). If you OR them, you get 0x0b - BS_OWNERDRAW. Consequently, the button acts as if it were a normal CBitmapButton and the GetCheck() member always returns 0, even if I do a SetCheck(1) immediately before.

So, is there any reasonable way to do this?
0
Comment
Question by:chrisdl
1 Comment
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1306150
Instead of supplying the BS_OWNERDRAW flag, another possibility would be to subclass the window and handle all of the painting yourself by catching WM_PAINT. Since you're going to be doing all tthe drawing anyway, this would be the better way to go. Your code would have to handle various states: focus and selected. Otherwise, it is pretty straight forward.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ORA-01403: no data found 43 83
abstract class with all non abstract mentods 6 72
Change to event 1 74
unix example issues 18 49
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 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

18 Experts available now in Live!

Get 1:1 Help Now