Prpfont.exe sample demonstrates how to set the desired font for your CPropertyPages in Visual C++ (142170)



The information in this article applies to:

  • The Microsoft Foundation Classes (MFC), when used with:
    • Microsoft Visual C++, 32-bit Editions 4.0
    • Microsoft Visual C++, 32-bit Editions 4.1
    • Microsoft Visual C++, 32-bit Enterprise Edition 4.2
    • Microsoft Visual C++, 32-bit Enterprise Edition 5.0
    • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
    • Microsoft Visual C++, 32-bit Professional Edition 4.2
    • Microsoft Visual C++, 32-bit Professional Edition 5.0
    • Microsoft Visual C++, 32-bit Professional Edition 6.0
    • Microsoft Visual C++, 32-bit Learning Edition 6.0
    • Microsoft Visual C++ .NET (2002)

This article was previously published under Q142170
Note Microsoft Visual C++ NET (2002) supported both the managed code model that is provided by the .NET Framework and the unmanaged native Windows code model. The information in this article applies to unmanaged Visual C++ code only.

SUMMARY

PRPFONT shows how to set the desired font for your CPropertyPages in the Resource Editor, and at run-time, set the sheet's font to be the same and size everything correctly. All of this is done in a class called CMySheet. A function called ChangeDialogFont() does the work of setting the font and resizing windows. CPropertySheet::BuildPropPageArray() was overridden so that the fonts in the pages are not reset.

MORE INFORMATION

In versions of Visual C++ earlier than 4.0, MFC had its own implementation of CPropertySheet. You could set the font for your CPropertySheet by setting the font of your first CPropertyPage dialog box resource in the Resource Editor. At run time, the sheet would use the font that you set and size everything according to the font. Starting with Visual C++ 4.0, MFC uses the Windows 95 PropertySheet control. This control will always use the system font for the sheet. This is by design. MFC will also force the pages to use the same font as the sheet. This is done in a function called BuildPropPageArray(). Because this is an undocumented function, it may change or be deleted in future versions of MFC.

CMySheet will use the font of the first active CPropertyPage to set the font and size of the CPropertySheet and its child windows. The CPropertyPages will appear with the font specified in the resource editor.

The following files are available for download from the Microsoft Download Center:


Prpfont.exe

For more information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to obtain Microsoft support files from online services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.


Modification Type:MajorLast Reviewed:6/1/2005
Keywords:kbhowto kbfile kbFont kbGDI kbProgramming kbPropSheet kbSample KbUIDesign KB142170 kbAudDeveloper