I have a dialog box with twelve radio buttons that are grouped in
pairs. The radio buttons are the first 12 tab stops in the dialog.
The OK and CANCEL buttons are the 13th and 14th tab stops, and the
static group box that surrounds the radio buttons is the 15th stop.
I have set the first radio button to have the WS_GROUP style and also
the 3rd radio button, the 5th, etc. so that the buttons behave in
pairs. I tried to set the font of the radio buttons with the
following code (as well as variations). It only sets the first radio
button and then the OK and CANCEL buttons to have the "Symbol" font.
I created a member variable for the first radio button so that I could
easily get a pointer to it. I then wanted to step through the next
bunch of controls to set them. I suppose that I could use the brute
force approach and make member variables for all of the radio button
controls, but that seems to lack elegance. Any suggestions? Here is
CDC* pDC = GetDC();
m_Font.CreateFont( blah blah blah ); // all of the parameters
// in my real code are set
// correctly for a 12 point
// "Symbol" font.
// note that m_font is a class member of type CFont that lives
// for the entire life of the dialog, as it should.
// Set the font of all the radio button labels to "symbol"
CWnd* pStartPoint = &m_ctrlradio1;
for (int i = 0; i < 12; i++)
pStartPoint = GetNextDlgTabItem(pStartPoint);