Solved

Owner Draw radio button

Posted on 1997-09-11
1
968 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 89
Creating an alias to a directory so I can change the directory 'contents' by changing the alias 5 85
wordmultiple challenge 12 118
Problem to event 3 76
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…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

911 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

20 Experts available now in Live!

Get 1:1 Help Now