Click to See Complete Forum and Search --> : changing default font


veesub
June 7th, 1999, 04:14 AM
How to change the font of a control?eg., button control.thanks

Roger Allen
June 7th, 1999, 04:19 AM
You will need to create a CFont object in the class dealing with the control, i.e. if the control is on a Dialog box, embed the CFont in the CDialog derived class. Create the font in your class constructor. In the OnInitDialog() function, use the SetFont function for your control either as :

GetDlgItem(IDC_CONTROL)->SetFont(&font) ;

or

m_control_name.SetFont(&font) ;

Don't forget to destroy the CFont object in your destructor. You have to do the destruction after the controls you selected the font into have been destroyed.


Roger Allen

veesub
June 7th, 1999, 06:22 AM
how to create a CFont object with predefined windows fonts?

Roger Allen
June 7th, 1999, 06:57 AM
The only way I know of doing this is to use the GetFont() function on an existing window and then apply that to your control. Of course you will have to get the font form a window you know has the font you want to use.

HTH


Roger Allen