locked
How to change default font of PorpertySheet and its PropPages ? RRS feed

  • Question

  • Hello,

    I changed the default font of ProprtyPage resource dialogs to "Tahoma" font (in ResourceView of MS Visual C++ 6.0) . But when I create a PropertySheet it changes fonts of all the pages back to default font "MS Shell Dlg". Could you please help me to solve this problem ? How can I change the default font of PropertySheet and its Pages to "Tahoma" font ?

    Thanks in advance,

    Mark.

    Friday, December 1, 2006 6:19 AM

Answers

  • It seems MFC always applies a predefined font for all of property pages. In my opinion it is difficult to alter this behaviour.

     

    As a possible short solution, you can try changing of the font of all of controls using SetFont function in OnInitDialog handler of your pages:

    CFont * font = new CFont();

    font->CreatePointFont(80, "Tahoma");

    SetFont(font);

     

    myButon.SetFont(font);

    myLabel.SetFont(font);

     

    // TODO: repeat for all of child controls

    // TODO: avoid memory leak

    Perhaps you can set the font only for some of controls where new font is really needed.

     

    As an another possible solution, I think you can try a long way: implementing of your own property sheet, based on a dialog which include a tab control (CTabCtrl) and several buttons, looking like standard property sheet. Your child pages should derive from CDialog, have the "Child" style, "Thin" border, "Control" attribute and no "Title bar". Each page must be created with Create member and positioned within your property sheet. You have to process notification messages from tab control and buttons and make only one page visible.

     

    I hope this makes sense.

    Saturday, December 2, 2006 7:28 PM
  • Thank you, Viorel.

    Font changing of all controls on PropPage helps, but it does not change the size of controls. So the only solution for now is to implement my own PropertySheet. Unless there is any alternative way of font changing.

    Thank you,

    Mark.

     

    Monday, December 4, 2006 11:55 PM

All replies

  • bump
    Saturday, December 2, 2006 5:32 PM
  • It seems MFC always applies a predefined font for all of property pages. In my opinion it is difficult to alter this behaviour.

     

    As a possible short solution, you can try changing of the font of all of controls using SetFont function in OnInitDialog handler of your pages:

    CFont * font = new CFont();

    font->CreatePointFont(80, "Tahoma");

    SetFont(font);

     

    myButon.SetFont(font);

    myLabel.SetFont(font);

     

    // TODO: repeat for all of child controls

    // TODO: avoid memory leak

    Perhaps you can set the font only for some of controls where new font is really needed.

     

    As an another possible solution, I think you can try a long way: implementing of your own property sheet, based on a dialog which include a tab control (CTabCtrl) and several buttons, looking like standard property sheet. Your child pages should derive from CDialog, have the "Child" style, "Thin" border, "Control" attribute and no "Title bar". Each page must be created with Create member and positioned within your property sheet. You have to process notification messages from tab control and buttons and make only one page visible.

     

    I hope this makes sense.

    Saturday, December 2, 2006 7:28 PM
  • Thank you, Viorel.

    Font changing of all controls on PropPage helps, but it does not change the size of controls. So the only solution for now is to implement my own PropertySheet. Unless there is any alternative way of font changing.

    Thank you,

    Mark.

     

    Monday, December 4, 2006 11:55 PM