Click to See Complete Forum and Search --> : Transparent Radio Button


scathenC
December 6th, 2006, 03:15 AM
Hey all,

I have an object on my window which acts kind of like a group box,
but has a specific background colour. I am trying to place a radio
button on top of this but due to it's non-transparency I am left
with the radio-buttons background colour to be different.

Can anyone help me with this problem?

So far I have tried WM_CTLCOLORBTN in the parent (however it seems
to only run this code on normal push buttons and not on radio-buttons).

WS_EX_TRANSPARENT does nothing.

I was hoping that I wouldn't have to owner draw another control just
for a simple background colour change! (**** WINDOWS).

Regards

C

humptydumpty
December 6th, 2006, 03:26 AM
How you created your radion button .is it a Dialog base Application or Something Else.if you are using Dialog base App then From radio Button Extended style you can Choose Transparent option.Which Will Work for you.

Thanx

scathenC
December 8th, 2006, 01:45 AM
Hi,

Nah I use CreateWindowEx() to create the radio button. Any other ideas?

C

humptydumpty
December 8th, 2006, 01:51 AM
Hi,

Nah I use CreateWindowEx() to create the radio button. Any other ideas?

C

Then Handle WM_CTLCOLOR message handler in your Code and Go ahead.


implement WM_CTLCOLOR handler member Function in your Code .now inside your onCtlColor you can use

int nCtrlId = pWnd->GetDlgCtrlID();
and can check for your radio button ID

Like
if(nCtrlId == Radiobutton ID)
{
//hbr is HBRUSH type here.
hbr = ::CreateSolidBrush(RGB(255,255,255));
pDC->SetBkMode( TRANSPARENT);
}


Thanx