
Change fonts in a property pages of property sheet
Bill,
Don't forget to make the font a member variable. I was trying to do
the same thing, use a number of different fonts in a property sheet.
Use Scott's suggestion with a member variable and you should be
all set.
Don Hanson
Quote:
> Bill,
> Dialogs and their child control windows are scaled according to the
> dialog
> font. If you have several property pages in a property sheet, they
> all
> need to use the same font (I'm pretty sure that the pages inherit the
> font
> that the property sheet uses). If each page used a different font,
> they'd
> need to be different sizes...
> You can, however, change the font used by individual controls in a
> property
> page at runtime. To do this, you'd create a font (usually in the
> OnInitDialog member function of the page), and call the SetFont method
> of
> the control window.
> There are various ways to create a font -- the easiest is to take the
> existing dialog font, and modify some aspect of it (make a BOLD
> version,
> for instance):
> BOOL CMyPropPage::OnInitDialog()
> {
> LOGFONT lf;
> // Fill the LOGFONT struct (lf) with information about
> // the dialog font
> VERIFY( GetFont()->GetObject(sizeof(lf), (LPSTR)&lf) );
> // We're going to make a BOLD version...
> lf.lfWeight = FW_BOLD;
> // Create the bold font (m_fontBold is a CFont member
> // variable of this class, defined in the header file)
> VERIFY( m_fontBold.CreateFontIndirect(&lf) );
> // Now, set one or more controls to use this bold font...
> GetDlgItem(IDC_EDIT1)->SetFont(&m_fontBold);
> GetDlgItem(IDC_EDIT2)->SetFont(&m_fontBold);
> .
> .
> .
> }
> --
> Scott Smith
> > Hello people there,
> > I had made a property sheet with two pages in it, later
> > I changed the font of one page, after compilation and runming
> of the
> > new program, the font remained unchanged. Dont know how to solve it
> > Many thanks in advance
> > Bill W