How to access RadioButton's round cycle/dot graphics?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What I am trying to do is to change the round button background to grey and
still keep the text label black, by overriding the "Enabled" property.

The purpose is to keep the radio button reader-friendly while keep it
non-editible.

Somemhow I didn't find any property exposed to change the button's
background color. Well, there IS a backcolor property but the color applies
to the whole button area including the text area. I want to change the little
round-dot button only.

Thanks

strout
 
Have you tried inheriting from the RadioButton, and overriding the OnPaint
method? (I'm sure there's somewhere a procedure to draw the ratiobutton's
circle, but I can't remember which or in which DLL). There's no backcolor
property for the circle, since it is drawn using this routine. You could
draw your own circle.
The other solution I can find is to draw a ratiobutton without any text, and
a Label that holds the text. OnClick of the label, you can change the value
of the ratiobutton to simulate the click on the ratiobutton's text, and you
can still "disable" the ratiobutton, so it gets drawn disabled.
Hope this helps.
VBen.
 
Strout,
Why not delete the radiobutton's Text property so it's blank, and add a
label control to the right of the radiobutton?

Regards,
Phil.
 
Thak you all

I added a usercontrol having a radio button and a label. Big problem is
solved.

Somehow I didn't get the ControlPaint.DrawFocusRectangle work. I try to draw
a focus rectangle around the usercontrol when get focus but the lost focus
event fired immediately after gotfocus. It end up drawing nothing.

It's not perfect so far and I gave up.
 
Back
Top