How would you determine the required width for a radiobutton control before creating it? As far as I see, three figures need to be determined:

1) the width of the bitmap;
2) the width of the gap, or blank space, between bitmap and caption;
3) the width of the caption string.

Part 3 is no problem (GetTextExtentPoint32 tells the width). Part 1 is more problematic (GetSystemMetrics retrieves lots of settings, none of which is exactly what I am after). And I am totally lost on part 2, the width of blank space between bitmap and caption.

At present I have various approximations in place (use the width of a small caption icon for the bitmap width; use the font's average character width for the gap's width). But they are not pixel-precise, in particular not across various DPI settings. Has anyone already solved that puzzle?
Posted on 2005-09-15 13:11:09 by Frank