Fonts on Property Sheets ??? - Programmer

This is a discussion on Fonts on Property Sheets ??? - Programmer ; Greetings: I have used the "OnInitDialog" of a CPropertySheet derived sheet to expand the size of the sheet and also move the tabs, pages and buttons down to make room for some additional controls along the top of the sheet. ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Fonts on Property Sheets ???

  1. Fonts on Property Sheets ???

    Greetings:

    I have used the "OnInitDialog" of a CPropertySheet derived sheet to expand
    the size of the sheet and also move the tabs, pages and buttons down to make
    room for some additional controls along the top of the sheet. This all went
    very well.

    Until I tried to add some edit boxes and static controls along the top of
    the property sheet. The static text boxes are being rendered with this font
    that is different from and is much larger that the "MS San Serif" pitch 8
    font that most dialogs default to.

    I created a pointer to a CFont and obtained the LOGFONT structure through
    that:

    CFont* pF;
    LOGFONT lf;
    pF = GetFont();
    pF->GetLogFont( &lf );

    The face name of the font return is something called "MS Shell Dlg".

    That's all very well, but I have tried to set a new font and the controls on
    the sheet are just ignoring it:

    strcpy(lf.lfFaceName, "MS Sans Serif");
    iRet = Font.CreateFontIndirect( &lf );
    SetFont( &Font );

    Can anyone help? Why does a property sheet default to such a strange and
    awkward font and how can I change it to "San Serif", 8 ?

    Thanks in advance,
    Mark Roberts,
    Toronto



  2. Re: Fonts on Property Sheets ???

    "Mark Roberts" wrote in message news:...
    > Greetings:
    >
    > I have used the "OnInitDialog" of a CPropertySheet derived sheet to expand
    > the size of the sheet and also move the tabs, pages and buttons down to make
    > room for some additional controls along the top of the sheet. This all went
    > very well.
    >
    > Until I tried to add some edit boxes and static controls along the top of
    > the property sheet. The static text boxes are being rendered with this font
    > that is different from and is much larger that the "MS San Serif" pitch 8
    > font that most dialogs default to.


    Try this in OnInitDialog:

    HFONT hFont = (HFONT)GetDlgItem(IDC_EDIT_ALREADY
    EXISING_CTRL)->SendMessage(WM_GETFONT);
    if (hFont != NULL)
    {
    GetDlgItem(IDC_EDIT_NEW_CTRL)->SendMessage(WM_SETFONT,
    (WPARAM)hFont);
    }

    HTH

  3. Re: Fonts on Property Sheets ???

    That worked!

    Thank you very much!

    Mark

    "Uwe Kotyczka" wrote in message
    news:4cd8ac7a.0404300536.3118ceaa@posting.google.c om...
    > "Mark Roberts" wrote in message

    news:...
    > > Greetings:
    > >
    > > I have used the "OnInitDialog" of a CPropertySheet derived sheet to

    expand
    > > the size of the sheet and also move the tabs, pages and buttons down to

    make
    > > room for some additional controls along the top of the sheet. This all

    went
    > > very well.
    > >
    > > Until I tried to add some edit boxes and static controls along the top

    of
    > > the property sheet. The static text boxes are being rendered with this

    font
    > > that is different from and is much larger that the "MS San Serif" pitch

    8
    > > font that most dialogs default to.

    >
    > Try this in OnInitDialog:
    >
    > HFONT hFont = (HFONT)GetDlgItem(IDC_EDIT_ALREADY
    > EXISING_CTRL)->SendMessage(WM_GETFONT);
    > if (hFont != NULL)
    > {
    > GetDlgItem(IDC_EDIT_NEW_CTRL)->SendMessage(WM_SETFONT,
    > (WPARAM)hFont);
    > }
    >
    > HTH




+ Reply to Thread