Saurabh's Blog

Help Integration | Windows Forms | Managed VSIP Integration | Random Rants

RadioButton doesn't resize when you increase the Font size

Sara forwarded me a customer question asking why radio button doesn’t resize when one changes the font on a Winform’s RadioButton control. Well, the simple answer is that is how underlying Windows control behaves and Winform’s control is just a wrapper on top of it. The next question is that I still want to have big radiobuttons. Well, “UI consistency cop” will say that even if you are able to change all the radiobuttons in your application to be big in size, you would still be inconsistent as your platform has small radiobuttons. However, if you still insist then you would have to

  • Inherit from RadioButton
  • You might have to set DoubleBuffer, AllPaintingInWmPaint and UserPaint ControlStyles to true to reduce the flicker.
  • Override OnPaint and Paint the radio button and text with bigger size. ControlPaint.DrawRadioButton should help you in drawing this. However you won’t get any help in drawing it themed until VS 2005 comes along. VS 2005 has renderers to help you with themed drawing. Until then, you are stuck with pinvoking UxTheme API.
  • I haven’t tried creating this control but I would think that you should able to get away without doing any custom hittesting (however, no guarantees; you are on your own).

These overridden, oversized controls (RadioButton, CheckBox etc.) are not hard to create. They do however create inconsistency and one should avoid going down that path.

Published Monday, May 24, 2004 7:39 PM by saurabhjain

Comments

 

David said:

If you can't see a standard-sized radio button, you need a bigger one, whether or not it's standard. Calling it an "inconsistency" doesn't improve anyone's sight.
May 25, 2004 8:38 AM
 

Sara Ford's WebLog said:

May 25, 2004 1:14 PM
 

Sara Ford's WebLog said:

May 25, 2004 1:15 PM
 

Jerry Pisk said:

David, if you can't see a standard size controls then you need to tell windows to use larger fonts (it's under Display in Control Panel), not have every single application do it on their own.
May 25, 2004 10:31 AM
 

David said:

Sounds good. I didn't realize that also changed the size of the radio buttons.
May 25, 2004 11:42 AM
 

Girish Bharadwaj said:

May 25, 2004 2:57 PM
 

Jeff said:

I don't see the default behavior that Jerry mentions. When I go to the desktop settings appearance tab and change the font size to extra large, all my windows apps get updated with the new size. But my winform controls don't change. The window title bar changes, but none of the controls do. What am I missing here?
August 10, 2004 12:47 PM
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker