Changing the Tab Label Font

We can change the font used by the tab control to draw the labels by using the SetFont() function in the CWnd class. The code given below is very simple and does not bother with resizing the tab control or the property sheet. This works fine for fonts that are smaller than the font being used by the tab control or about the same size. A good place to put this code in is the OnInitDialog() of the CPropertySheet derived class.

	// m_fontEdit is a member variable
	// Create a bold font
	m_fontEdit.CreateFont( -8, 0, 0, 0, 700, 0, 0, 0, 1,
			0, 0, 0, 0, _T("MS Sans Serif") );
	GetTabControl()->SetFont( &m_fontEdit );

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read