?
Solved

Owner Draw radio button

Posted on 1997-09-11
1
Medium Priority
?
977 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
[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
1 Comment
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 200 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

752 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